Golang is one of the leading tools to build microservices. In a cloud-native application, a microservice is a loosely coupled application that provides important functionality. This article explores the steps you need to take to set up an authentication microservice for your application. Most of ...
Golang is one of the top-paying, in-demand programming languages with many applications. When paired with frameworks like Gin, Revel, and gorilla/mux, you can easily create an API with Go. ✕Remove Ads Learn how to create a CRUD API in Golang using the Gin HTTP framework. ...
echo $GOPATH Alternatively you can also use below command: bash go env GOPATH Method 2: Using the go command go clean command With thego clean -iflag, you can remove the archive files and executable binaries that go install (or go get) creates for a package. Both of these are often ...
Below is how we can use for range loop to store slice variables into a struct in Golang. package main import ( "fmt" ) type DataStr struct { Key int Value string } func main() { data := []string{"AWS", "GoLinux", "Google", "Linux", "Chrome"} var res []DataStr for key,...
Let's start with a quick and easy "Hello World" server to verify that we can run Go programs. We'll start by fetching Gorilla, a web toolkit that simplifies the process of writing HTTP servers: go get -u github.com/gorilla/mux Next, create a file called main.go, and paste these li...
go get github.com/gorilla/websocket Examples of code Client side: // init // schema – can be ws:// or wss:// // host, port – WebSocket server u := url.URL{ Scheme: {schema}, Host: {host}:{port}, Path: "/", } c, _, err := websocket.DefaultDialer.Dial(u.String(), ...
(13/49) Wrote github.com/golang/snappy@master (14/49) Wrote github.com/hashicorp/hcl@master (15/49) Wrote github.com/gorilla/mux@v1.6.2 (16/49) Wrote github.com/go-logfmt/logfmt@v0.3.0 (17/49) Wrote github.com/go-kit/kit@v0.6.0 ...
There are multiple ways we can pass slice to function in golang. We will explore through some of the examples
Golang sort array of ints using 3 different examples. Example 1: Convert to int slice and then use the Ints() function. Example 2: Using Slice() function to sort int array in ascending order. Example 3: Write function to do Bubble Sort an array