Skip to main content

Tag: Dev

Use “replace” in go.mod to Point to a Local Module

If you want to the local version of a dependency in Go rather than one in a remote repository, use the replace keyword. The replace line goes above your require statements, like so: module github.com/rnemeth90/foo replace github.com/rnemeth90/bar => /Users/rnemeth90/Projects/bar require ( github.com/rnemeth90/bar v1.0.0 ) Now when you compile this module go build or go install, it will use your local code rather than the remote dependency. According to the docs, you do need to make sure that the code you’re pointing to also has a go.

Powershell for Devops - Querying REST APIs with Powershell

This will be a short post on querying REST APIs with Powershell. It’s hard to argue that REST APIs are the predominant technology for interacting with networked services. They provide a gateway for interacting with a 3rd party (or self-hosted) product without having to go through the exercise of a more complicated integration. REST APIs communicate in a common format, typically JSON. However, most will allow us to choose the response format by specifying an option in the ‘Accept’ header.

Reading Json Files with Go

JSON is a widely used format for representing structured data. Developers like it because it is easy to read, most common languages have a library for interacting with it, and most public APIs accept JSON in HTTP requests. In this post, we’ll look at parsing a JSON file using Go! We will be using the io/ioutil package to open a json file on local disk, and encoding/json to parse the JSON data within the file into a memory structure.