Posts for: #Go

Safely using Maps in Golang: Differences in declaration and initialization

Introduction

This week, I was working on one of the API wrapper packages for golang, and that dealt with sending post requests with URL encoded values, setting cookies, and all the fun stuff. However, while I was constructing the body, I was using url.Value type to construct the body, and use that to add and set key-value pairs. However, I was getting a wired nil pointer reference error in some of the parts, I thought it was because of some of the variables I set manually. However, by debugging closer, I found out a common pitfall or bad practice of just declaring a type but initializing it and that causing nil reference errors.

[]

Techstructive Weekly #5

Week #5

This week felt like a slog, with many challenges and frustrations. However, by the end of the week, I found my stride and got excited about the direction I’m heading. It's amazing how quickly things can shift from feeling like the end of the world to experiencing a burst of excitement.

Techstructive Weekly #4

Techstructive Weekly #4

It was an exhilarating week for me, learned a lot of stuff, wrote a lot of code, pushed a lot of bugs, and tweeted a lot. This week, I wrote a lot of Python scripts at my work for experimentation setup and testing a lot of things, I was learning and prototyping my idea of Audiofy with Appwrite cloud, and read some inspiring articles.

Techstructive Weekly #2

Week #2

This week I made some mistakes at my job (well they were the week before) but they got caught after the review. I learned how powerful reviews could be at catching flaws in code. I also caught a bug while pair programming, it was a mixed feeling as a developer for me this week.

Techstructive Weekly #1

Week #1

This week, I had a ton of fun on the side as I finally made the MVP of a side project. An SSG with a Content Management System-like interface. an SSG with an editor that syncs up the posts from a database.

Golang Web: PUT Method

Introduction

In this section of the series, we will be exploring how to send a PUT HTTP request in golang. We will understand how to send a basic PUT request, create an HTTP request, update a resource on a server, parsing the content from struct to json, headers, etc in the following section of this post.

What is a PUT Method

A PUT method is a type of request that is used to update or modify an entire resource on a server/database.

[]

Golang Web: POST Method

Introduction

In this section of the series, we will be exploring how to send a POST HTTP request in golang. We will understand how to send a basic POST request, create an HTTP request, and parse json, structs into the request body, add headers, etc in the following sections of this post. We will understand how to marshal the golang struct/types into JSON format, send files in the request, and handle form data with examples of each in this article. Let’s answer a few questions first.

[]

Golang Web: GET Method

Introduction

In this section of the series, we will be exploring how to send a GET HTTP request in golang. We will be understanding how to send a basic GET request, create an HTTP request and customize the client, add headers, read the response body, etc in the following sections of this post.

What is a GET method?

A GET method in the context of an HTTP request is an action that is used to obtain data/resources. The GET method is used in a web application to get a resource like an HTML page, image, video, media, etc.

[]