Skip to content

Instantly share code, notes, and snippets.

View gnsalok's full-sized avatar
🎯
Focusing

Alok Tripathi gnsalok

🎯
Focusing
View GitHub Profile
@gnsalok
gnsalok / go_dependency_management.txt
Created March 31, 2023 13:23
Dependency management in Go
// Initialise the module
$ go mod init <module_name> // ex : github.com/gnsalok/ps-go
// If you import any package, you can run the below command to get modules, and it will add a module under the go.mod file
$go mod tidy
// To verify why other dependencies are in the go.sum file.
$ go mod why -m <module_name> // ex : github.com/gorilla/websocket
// Get a specific version of a package
@gnsalok
gnsalok / Benchmark value stored as interface vs struct
Last active August 10, 2024 15:01
Benchmark value stored as interface vs struct
package benchamarking
import (
"testing"
)
type MyStruct struct {
Value int
}