Gang Of Coders
Home
About Us
Contact Us
All Go Solutions on Gang of Coders
Total of 696 Go Solutions
Decode JSON with unknown structure
Json
Go
cap vs len of slice in golang
Go
Slice
Constant struct in Go
Go
How to prepend int to slice
Arrays
Go
Slice
Prepend
GoLand (JetBrains) shows error message "Unresolved Reference". But Code compiles and runs
Go
Jetbrains Ide
Goland
How to cast reflect.Value to its type?
Reflection
Go
Does it make sense to have two packages in the same directory?
Go
Package
Golang defer behavior
Go
json unmarshal time that isn't in RFC 3339 format
Json
Go
Function in same package undefined
Go
Error: struct Type is not an expression
Struct
Go
How to get a value from map
Go
golang json marshal: how to omit empty nested struct
Json
Go
Why can't a string be nil in Go?
Go
Variable Assignment
Regex with replace in Golang
Regex
Go
unsupported Scan, storing driver.Value type []uint8 into type *time.Time
Mysql
Go
Sqlx
Go 1.18 build error on Mac: "unix/syscall_darwin.1_13.go:25:3: //go:linkname must refer to declared function or variable"
Macos
Go
X does not implement Y (... method has a pointer receiver)
Pointers
Go
Methods
Interface
How to initialize members in Go struct
New Operator
Go
How do I escape “{{” and “}}” delimiters in Go templates?
Go
Go Templates
How to make a channel that receive multiple return values from a goroutine
Go
How to execute an IN lookup in SQL using Golang?
Sql
Go
How can I clear the terminal screen in Go?
Go
Go golang, syntax error: unexpected ++, expecting :
Syntax
Go
How to get the current function name
Go
Import struct from another package and file golang
Struct
Go
Package
How to get the pointer of return value from function call?
Pointers
Go
Golang converting from rune to string
String
Parsing
Go
Unicode
Rune
Organize local code in packages using Go modules
Go
Go Modules
Go Packages
How to get the directory of the currently running file?
Go
Can Go really be that much faster than Python?
Python
Performance
Go
Handling JSON Post Request in Go
Json
Go
Go: returning from defer
Go
Return
Deferred
Panic
JSON unmarshaling with long numbers gives floating point number
Json
Floating Point
Go
Marshalling
Idiomatic way to validate structs
Validation
Go
How to list installed go packages
Go
Why can't the interface be implemented with pointer receivers
Pointers
Interface
Go
Go failing - expected 'package', found 'EOF'
Go
Package
Eof
Is it possible to get the current root of package structure as a string in golang test?
Go
How does defer and named return value work?
Go
What's the difference between ResponseWriter.Write and io.WriteString?
String
Http
Go
Slice
How to mock http.Client Do method
Unit Testing
Testing
Go
Mocking
How to break out of nested loops in Go?
Loops
Go
Embedding instead of inheritance in Go
Inheritance
Go
Embedding
Array and slice data types
Arrays
Go
Slice
Pass by-Value
Func
In a template how do you access an outer scope while inside of a "with" or "range" scope?
Go
Go Templates
Using named matches from Go regex
Regex
Go
How to test the main package functions in golang?
Unit Testing
Testing
Import
Go
Main
How to get the stacktrace of a panic (and store as a variable)
Debugging
Go
Panic
Resource usage of google Go vs Python and Java on Appengine
Java
Python
Google App-Engine
Go
Adding a user-defined language in Notepad++
Go
Notepad++
User Defined
Why add "()" after closure body in Golang?
Go
Closures
Why does json.Unmarshal work with reference but not pointer?
Json
Go
What is the difference between type conversion and type assertion?
Go
Type Conversion
Type Assertion
Invoking struct function gives "cannot refer to unexported field or method"
Pointers
Struct
Go
Getting invalid operation: mymap["title"] (type interface {} does not support indexing) when trying to index a map
Map
Go
Error in importing custom packages in Go Lang
Go
URL Builder/Query builder in Go
Rest
Url
Go
How to pretty print variables
Go
Pretty Print
How to convert (type *bytes.Buffer) to use as []byte in argument to w.Write
Go
Escape Variables with Printf
Go
Golang blocking and non blocking
Multithreading
Go
Nonblocking
How to sort struct with multiple sort parameters?
Sorting
Go
time.Time Round to Day
Go
Copy one struct to another where structs have same members and different types
Go
Relative imports in Go
Go
Insert a value in a slice at a given index
Go
Slice
"Exported type should have comment or be unexported" golang VS Code
Go
Visual Studio-Code
Golint
First class functions in Go
Go
Functional Programming
In Go, how to write a multi-line statement?
Go
Golang conditional compilation
Go
Build
Go Build
Switch or if/elseif/else inside golang HTML templates
Html
Templates
Go
Go Templates
Cannot unmarshal string into Go value of type int64
Json
Go
Marshalling
Unmarshalling
Golang. What to use? http.ServeFile(..) or http.FileServer(..)?
Go
Server
Strip all whitespace from a string
Go
Should a Go package ever use log.Fatal and when?
Go
Fatal Error
Remove path from filename
Go
Can I have multiple GOPATH directories?
Go
What is the difference between switch and select in Go?
Go
Switch Statement
Goroutine
Error "protoc-gen-go: program not found or is not executable"
Go
Protocol Buffers
Grpc
Proto
Protoc
Is it possible to include inline assembly in Go code?
Go
Assembly
Inline Assembly
Golang Determining whether *File points to file or directory
File
Go
Call a method from a Go template
Go
Go Templates
Address of a temporary in Go?
Pointers
Return
Go
Temporary
Rvalue
How do I batch sql statements with package database/sql
Sql
Go
Defining golang struct function using pointer or not
Go
How to use "internal" packages?
Go
go tool: no such tool "tour"
Macos
Go
What does allocs/op and B/op mean in go benchmark?
Go
Benchmarking
In Go is it possible to iterate over a custom type?
Go
Iterator
Golang Convert String to io.Writer?
String
Go
Writer
golang sort slice ascending or descending
Sorting
Go
Which of coroutines (goroutines and kotlin coroutines) are faster?
Go
Kotlin
Coroutine
Goroutine
Kotlin Coroutines
How do you mark code as deprecated in Go?
Go
How can I pretty-print JSON using Go?
Json
Go
Pretty Print
How to disable a log.Logger
Logging
Go
Flags
Writing a Python extension in Go (Golang)
Python
C
Go
Cython
How to pipe an HTTP response to a file in Go?
Go
Golang http request results in EOF errors when making multiple requests successively
Go
What is the GOMAXPROCS default value?
Runtime
Go
How do I reverse sort a slice of integer Go?
Go
Can someone explain why GOPATH is convenient and how it should be used in general?
Go
error connecting to database with mysqldriver
Mysql
Go
Why would I make() or new()?
Go
How can I work with SQL NULL values and JSON in a good way?
Sql
Json
Go
Explain Type Assertions in Go
Go
What is a rune?
Go
Rune
How to run test cases in a specified file?
Go
Delete key in map
Dictionary
Go
Type converting slices of interfaces
Go
Go Reflect
Go Interface
How to check if a map contains a key in Go?
Dictionary
Go
Go Map
Decoding JSON using json.Unmarshal vs json.NewDecoder.Decode
Json
Go
What does an underscore in front of an import statement mean?
Go
Import
Constructors in Go
Oop
Constructor
Go
Converting Go struct to JSON
Json
Go
Convert byte slice to io.Reader
Go
Is it possible to capture a Ctrl+C signal (SIGINT) and run a cleanup function, in a "defer" fashion?
Signals
Go
Sigterm
List directory in Go
Go
Is there a way to iterate over a range of integers?
Loops
Go
Integer
Range
Does Go provide REPL?
Go
Read Eval-Print-Loop
Organizing a multiple-file Go project
Go
How to delete an element from a Slice in Golang
Go
Slice
Removing fields from struct or hiding them in JSON Response
Json
Go
How does Go compile so quickly?
Performance
Go
Build
Compiler Construction
golang why don't we have a set datastructure
Data Structures
Go
Set
How can I read a whole file into a string variable
String
File
Go
What is the `zero` value for time.Time in Go?
Time
Go
Null
What's the proper way to "go get" a private repository?
Git
Go
How does Go update third-party packages?
Go
How to `go test` all tests in my project?
Testing
Go
Can functions be passed as parameters?
Function
Go
Declare a constant array
Arrays
Go
Constants
How to get the last element of a slice?
Go
Slice
Stack vs heap allocation of structs in Go, and how they relate to garbage collection
Go
Heap Memory
Stack Memory
Is it OK to leave a channel open?
Go
Channel
How to set headers in http get request?
Http
Go
Application auto build versioning
Go
Parsing RFC-3339 / ISO-8601 date-time string in Go
Date
Go
cannot convert data (type interface {}) to type string: need type assertion
Go
Type Mismatch
How to set default values in Go structs
Go
Struct
Initialization
Default Value
How do you print in a Go test using the "testing" package?
Testing
Go
Is assert evil?
C++
C
Error Handling
Go
Assert
How to properly seed random number generator
Random
Go
Lowercase JSON key names with JSON Marshal in Go
Json
Go
Serialization
Tags
Marshalling
How to import local packages without gopath
Go
Package
"undefined" function declared in another file?
Go
Undefined
Func
Can I list all standard Go packages?
Go
Go Packages
How to use C++ in Go
C++
Wrapper
Go
How are people managing authentication in Go?
Authentication
Go
The maximum value for an int type in Go
Numbers
Go
How to efficiently concatenate strings in go
String
Go
String Concatenation
How to trim leading and trailing white spaces of a string?
Go
How to join a slice of strings into a single string?
Go
Slice
nil detection in Go
Go
Null
How can I "go run" a project with multiple files in the main package?
Go
Package
How can I install a package with go get?
Go
Go Toolchain
How to use custom packages
Import
Package
Go
Import cycle not allowed
Go
Golang tests in sub-directory
Build
Go
What is the shortest way to simply sort an array of structs by (arbitrary) field names?
Sorting
Go
Access HTTP response as string in Go
Networking
Go
Is there a way to do repetitive tasks at intervals?
Go
Value receiver vs. pointer receiver
Function
Pointers
Go
Does a break statement break from a switch/select?
Select
Switch Statement
Go
Break
Change values while iterating
Arrays
For Loop
Go
Go test string contains substring
Go
Substring
How to parse unix timestamp to time.Time
Go
Time
Unix Timestamp
How to get JSON response from http.Get
Json
Go
How to format current time using a yyyyMMddHHmmss format?
Time
Go
Format
Timestamp
Convert a float64 to an int in Go
Go
How to do a https request with bad certificate?
Ssl
Https
Go
Is it safe to remove selected keys from map within a range loop?
Dictionary
For Loop
Go
How to compare if two structs, slices or maps are equal?
Go
Go Reflect
How to check for an empty struct?
Struct
Go
How to point Go module dependency in go.mod to a latest commit in a repo?
Git
Go
Module
Go << and >> operators
Go
Bitwise Operators
Mock functions in Go
Unit Testing
Mocking
Go
How to get the number of characters in a string
String
Go
Character
String Length
Setting HTTP headers
Http
Go
Cors
Http Headers
Go build: "Cannot find package" (even though GOPATH is set)
Build
Go
Package
How to define multiple name tags in a struct
Json
Struct
Go
What is the usage of backtick in golang structs definition?
Go
What does the '.' (dot or period) in a Go import statement do?
Import
Go
How do you write multiline strings in Go?
String
Go
Multiline
No startswith,endswith functions in Go?
String
Go
How to initialize a nested struct?
Go
What do three dots "./..." mean in Go command line invocations?
Go
Force retesting or disable test caching
Testing
Go
Default value in Go's method
Go
Default Value
Function Call
Default Arguments
How to add new methods to an existing type in Go?
Go
Extension Methods
From io.Reader to string in Go
Go
How to declare a constant map in Golang?
Go
Go naming conventions for const
Go
Constants
Naming Conventions
What's the recommended way to connect to MySQL from Go?
Mysql
Database
Go
How to import and use different packages of the same name
Go
Package
Does the Go language have function/method overloading?
Go
How to split a string and assign it to variables
String
Go
Split
How to import local packages in go?
Go
What is a concise way to create a 2D slice in Go?
Go
Slice
How to measure test coverage in Go
Unit Testing
Testing
Go
Code Coverage
Go install fails with error: no install location for directory xxx outside GOPATH
Macos
Go
Why can't I duplicate a slice with `copy()`?
Go
Slice
How to call function from another file in Go
Go
Pair/tuple data type in Go
Go
Tuples
Iterate through the fields of a struct in Go
Go
Go Reflect
How do I do a literal *int64 in Go?
Pointers
Go
Struct
Literals
Extracting substrings in Go
Go
Substring
cannot download, $GOPATH not set
Macos
Installation
Go
What are conventions for filenames in Go?
Go
Naming Conventions
Golang: How to pad a number with zeros when printing?
Go
json.Marshal(struct) returns "{}"
Json
Go
Marshalling
How to install the current version of Go in Ubuntu Precise
Ubuntu
Go
What's the meaning of interface{}?
Go
"<type> is pointer to interface, not interface" confusion
Pointers
Go
Interface
Call Go functions from C
C
Shared Libraries
Go
Dynamic Linking
Cross compile Go on OSX?
Go
Compilation
Cross Compiling
Why can't I assign a *Struct to an *Interface?
Go
Difference between fmt.Println() and println() in Go
Go
Println
Unmarshaling nested JSON objects
Json
Go
Split a string on whitespace in Go?
Regex
Go
Is there a method to generate a UUID with go language
Go
Uuid
Concatenate two slices in Go
Go
Append
Slice
Variadic Functions
Subtracting time.Duration from time in Go
Datetime
Go
How to check whether a file or directory exists?
File
Go
Indentation in Go: tabs or spaces?
Go
Formatting
Indentation
Gofmt
Go: panic: runtime error: invalid memory address or nil pointer dereference
Go
How do you clear a slice in Go?
Arrays
Go
Slice
Convert an integer to a float number
Go
How to convert interface{} to string?
Go
What does go build build? (go build vs. go install)
Go
Build
Compilation
Convert time.Time to string
String
Time
Go
Get current time as formatted string in Go?
Timestamp
Go
Is there a foreach loop in Go?
Go
Foreach
Slice
How to set timeout for http.Get() requests in Golang?
Http
Get
Timeout
Go
How to print the values of slices
Arrays
Go
How to do one-liner if else statement?
If Statement
Go
Conditional Operator
Ternary
Go Unpacking Array As Arguments
Go
Argument Unpacking
How can I do test setup using the testing package in Go
Unit Testing
Go
Why does Go have a "goto" statement?
Go
Goto
Delete element in a slice
Go
What is an idiomatic way of representing enums in Go?
Enums
Go
Genetics
How to convert an int value to string in Go?
String
Go
Int
Converters
How to determine an interface{} value's "real" type?
Types
Type Conversion
Go
In Go's http package, how do I get the query string on a POST request?
Go
Query String
how to listen to N channels? (dynamic select statement)
Go
Are maps passed by value or by reference in Go?
Go
"used as value" in function call
Go
Proper package naming for testing with the Go language
Unit Testing
Go
Which is the nicer way to initialize a map?
Go
How to break a long line of code in Golang?
Go
Syntax
Correct approach to global logging
Logging
Go
Go Interface Fields
Struct
Interface
Go
Optional Parameters in Go?
Go
Overloading
Partly JSON unmarshal into a map in Go
Json
Map
Go
How do I import a specific version of a package using go get?
Go
Package
Package Managers
What is the zero for string?
String
Go
SSL is not enabled on the server
Go
How to wait for all goroutines to finish without using time.Sleep?
Go
Synchronization
Goroutine
How to serve up a JSON response using Go?
Json
Go
How to index characters in a Golang string?
String
Go
Character
What could happen if I don't close response.Body?
Go
Why no generics in Go?
Generics
Functional Programming
Go
Runtime error: assignment to entry in nil map
Map
Go
Yaml
How to convert a bool to a string in Go?
Go
Type Conversion
How to stop a goroutine
Go
Goroutine
Channels
How to change int into int64?
Go
Convert interface{} to int
Go
Declare slice or make slice?
Go
Allocation
Slice
Separating unit tests and integration tests in Go
Unit Testing
Go
Integration Testing
Testify
How to set HTTP status code on http.ResponseWriter
Go
How can I efficiently download a large file using Go?
Go
Download
Convert Go map to json
Json
Go
ToString() function in Go
Go
Tostring
Using forked package import in Go
Go
Is there a way to iterate over a slice in reverse in Go?
Go
How to write log to file
Go
Logging
Multiple values in single-value context
Go
Error Handling
Return Value
Multiple Return-Values
How to create nested directories using Mkdir in Golang?
Go
Mkdir
How to find out element position in slice?
Position
Go
Slice
When to use os.Exit() and panic()?
Go
Exit
How can I see the internal compile commands which fail in a "go get" installation?
Go
How to reverse a string in Go?
String
Go
Reverse
How to print struct variables in console?
Struct
Go
no new variables on left side of :=
Variables
Go
Colon Equals
Using reflect, how do you set the value of a struct field?
Go
Reflection
Go Reflect
How to get the name of a function in Go?
Go
Reflection
Go Reflect
range over interface{} which stores a slice
Go
Reflection
Slice
Go Reflect
Golang production web application configuration
Web
Go
Production
Converting map to struct
Go
In Go how to get a slice of values from a map?
Dictionary
Go
Slice
What's the best way to bundle static resources in a Go program?
Go
Accessing local packages within a go module (go 1.11)
Go
Vgo
How to print boolean value in Go?
Boolean
Go
Range references instead values
Pointers
Reference
Go
Go doing a GET request and building the Querystring
Http
Go
What is a sensible way to layout a Go project
Go
Project
How to check if a file exists in Go?
File
Go
Standard Library
Make a URL-encoded POST request using `http.NewRequest(...)`
Http
Go
How to disable Golang unused import error
Go
mkdir if not exists using golang
Go
Directory
Path
Filepath
Mkdir
What does go install do?
Go
How to do date/time comparison
Datetime
Go
Datetime Comparison
What are the problems that are mitigated by not allowing nested function declarations in Go?
Function
Go
Declaration
Why can I type alias functions and use them without casting?
Types
Casting
Go
How do you get a Golang program to print the line number of the error it just called?
Error Handling
Go
What is "_," (underscore comma) in a Go declaration?
Variables
Go
Adding hours, minutes, seconds to current time
Go
Time
What's the point of having pointers in Go?
Pointers
Go
What kind of Garbage Collection does Go use?
Garbage Collection
Go
How to not marshal an empty struct into JSON with Go?
Json
Go
Why is Go so slow (compared to Java)?
Java
Performance
Go
Benchmarking
How do I convert a string to a lower case representation?
Go
Catching return values from goroutines
Go
Concurrency
Goroutine
How can I pass a slice as a variadic input?
Go
Go time.Now().UnixNano() convert to milliseconds?
Time
Go
Unix Timestamp
Date Conversion
How to test panics?
Testing
Go
How do I compare strings in GoLang?
Go
How to dump goroutine stacktraces?
Go
Example for sync.WaitGroup correct?
Go
Goroutine
Error message "go: go.mod file not found in current directory or any parent directory; see 'go help modules'"
Linux
Go
What's Go's equivalent of argv[0]?
Go
Redirect stdout pipe of child process in Go
Go
Stdout
Command Line-Interface
Reason for huge size of compiled executable of Go
Go
Executable
How to get all dependency files for a program
Go
How to search for an element in a golang slice
Go
Struct
Slice
How to stop http.ListenAndServe()
Go
Read text file into string array (and write)
Go
Iterating through map in template
Go
Go Templates
How can I convert a zero-terminated byte array to string?
Go
Getting "bytes.Buffer does not implement io.Writer" error message
Go
Cannot convert []string to []interface {}
Type Conversion
Go
Why do I get a "cannot assign" error when setting value to a struct as a value in a map?
Go
exec: "gcc": executable file not found in %PATH% when trying go build
Windows
Go
Build
Hyperledger Fabric
Cgo
What is the difference between backticks (``) & double quotes ("") in golang?
Go
Obtain user's home directory
Go
Home Directory
Obtaining a Unix Timestamp in Go Language (current time in seconds since epoch)
Unix
Timestamp
Go
How to compile Go program consisting of multiple files?
Go
Build
Compiler Errors
What are the use(s) for tags in Go?
Go
Struct
Reflection
Tags
Golang converting string to int64
String
Go
Int64
What is the difference between go get and go install?
Go
Why is port a string and not an integer?
Http
Go
Port
Append to a file in Go
File Io
Go
How to get process details from its PID
Go
Number of elements in a channel
Go
Go Error Handling Techniques
Go
How to test the equivalence of maps in Golang?
Testing
Maps
Go
Equivalence
Table Driven
Create a io.Reader from a local file
Go
How to clear a map in Go?
Go
Multiple goroutines listening on one channel
Go
Concurrency
Goroutine
How can I get the string representation of a struct?
String
Struct
Go
Getting the union of two maps in go
Map
Go
Union
Init array of structs in Go
Arrays
Struct
Go
importing go files in same folder
Import
Path
Go
Is this casting in golang?
Go
Types
Type Conversion
How do I check for an empty slice?
Go
Slice
Why are lists used infrequently in Go?
Arrays
List
Go
How to perform division in Go
Math
Go
Floating Point
Integer Division
How to access command-line arguments passed to a Go program?
Go
How to count items in a Go map?
Map
Go
Install go with brew, and running the gotour
Macos
Installation
Go
Homebrew
Collect values in order, each containing a map
Go
Hashmap
How to do "go get" on a specific tag of a github repository
Git
Go
Github
How to perform file system scanning
File
Go
Directory
How do I do a case insensitive regular expression in Go?
Regex
Go
How to reliably detect os/platform in Go
Operating System
Go
What are the primary differences between 'gc' and 'gccgo'?
Go
Gccgo
Iterating through a golang map
Map
Go
Loops
How do you serve a static html file using a go web server?
Go
How to read a text file?
Go
"package XXX is not in GOROOT" when building a Go project
Go
Goland
How can I sort a Map[string]int by its values?
Sorting
Dictionary
Go
Meaning of ...interface{} (dot dot dot interface)
Go
What exactly does runtime.Gosched do?
Concurrency
Go
How to check a channel is closed or not without reading it?
Go
Channel
How to get file length in Go?
File
Go
How to find the type of an object in Go?
Go
Go Reflect
How to assign string to bytes array
Go
In Go HTTP handlers, why is the ResponseWriter a value but the Request a pointer?
Pointers
Go
What is the difference between int and int64 in Go?
Go
How to copy a map?
Go
How can I print to Stderr in Go without using log
Error Handling
Go
How do you get the output of a system command in Go?
Go
What does an underscore and interface name after keyword var mean?
Syntax
Interface
Go
Underscores
How to convert ISO 8601 time in golang?
Go
Format a Go string without printing?
String
Go
Formatting
String Formatting
Does Go have lambda expressions or anything similar?
Go
Lambda
Meaning of a struct with embedded anonymous interface?
Go
How to analyze golang memory?
Performance
Memory
Go
Profile
Correct way of getting Client's IP Addresses from http.Request
Http
Go
Ip
Which way to name a function in Go, CamelCase or Semi-CamelCase?
Go
Naming Conventions
How to uninstall Go?
Go
How to reduce compiled file size?
Go
How to decode JSON with type convert from string to float64
Json
Go
What is channel buffer size?
Go
Channel
Why should I use log.Println instead of fmt.Println?
Logging
Go
How to send a POST request in Go?
Go
Execute gofmt on file save in IntelliJ
Go
Intellij Idea
Goland
How do I convert a database row into a struct
Sql
Go
What are the benefits of using Nginx in front of a webserver for Go?
Web Services
Http
Nginx
Webserver
Go
"unrecognized import path" with go get
Go
Installation
Golang testing: "no test files"
Testing
Go
Terminal
Go-compiled binary won't run in an alpine docker container on Ubuntu host
Go
Docker
Busybox
Alpine
What is the idiomatic Go equivalent of C's ternary operator?
Go
Ternary Operator
Conditional Operator
Can Go compiler be installed on Windows?
Windows
Go
Check if string is int
Go
How to check the uniqueness inside a for-loop?
For Loop
Go
Append
Slice
How to convert from []byte to int in Go Programming
Tcp
Client Server
Byte
Type Conversion
Go
Is it possible to have nested templates in Go using the standard library?
Google App-Engine
Go
Template Engine
Mustache
What is the difference between []string and ...string in golang?
String
Go
Return pointer to local struct
Go
Reusing http connections in Go
Go
POST data using the Content-Type multipart/form-data
File Upload
Curl
Go
Multipart
Has been blocked by CORS policy: Response to preflight request doesn’t pass access control check
Rest
Google Chrome
Go
Axios
Cors
Should go.sum file be checked in to the git repository?
Go
Exec a shell command in Go
Go
Shellexecute
How to check variable type at runtime in Go language
Go
Assignment operator in Go language
Syntax
Go
How to exit a go program honoring deferred calls?
Go
Exit
Deferred
How safe are Golang maps for concurrent Read/Write operations?
Go
Concurrency
Hashmap
Are slices passed by value?
Go
Slice
Pass by-Value
Reading a file line by line in Go
String
File
Parsing
Go
Line
Reading an integer from standard input
Go
Stdin
shuffle array in Go
Arrays
Go
Go fmt on a whole source tree
Go
Converting from an integer to its binary representation
Binary
Go
Numeric
Access struct property by name
Go
Go Reflect
How to assign default value if env var is empty?
Go
Environment Variables
Go examples and idioms
Go
How do I print the pointer value of a Go object? What does the pointer value mean?
Go
Simple way to copy a file
File
Copy
Go
How do I install requirements in Go? "cannot find package"
Go
How do you express a "null" value in Go?
Go
Is Go subject to the same subtle memory-leaks that Java is?
Java
Memory Leaks
Go
When is the init() function run?
Go
Init
How can I handle http requests of different methods to / in Go?
Go
GOBIN not set: cannot run go install
Go
Convert array to slice in Go
Go
Unmarshal JSON with some known, and some unknown field names
Json
Go
Difference between http.Handle and http.HandleFunc?
Go
How do I get the local IP address in Go?
Go
Access a map value using a variable key in a Go template
Go
Templates
Go Templates
How to get the last X Characters of a Golang String?
String
Go
Character
For loop of two variables in Go
Go
How do you create a new instance of a struct from its type at run time in Go?
Go
Reflection
Go Reflect
How to pipe several commands in Go?
Go
Pipe
os.Mkdir and os.MkdirAll permissions
Linux
Go
How can I iterate over a string by runes in Go?
String
Loops
Go
Rune
Golang append an item to a slice
Go
How to read files and stdout from a running Docker container
Logging
Go
Docker
How to get capturing group functionality in Go regular expressions
Regex
Go
Capture Group
Pointers vs. values in parameters and return values
Pointers
Go
Golang read request body multiple times
Http
Go
Server
Max number of goroutines
Go
Multitasking
Goroutine
How are Go channels implemented?
Go
Channel
Can you declare multiple variables at once in Go?
Go
Variable Assignment
goland how to use gofmt?
Go
Goland
Function declaration syntax: things in parenthesis before function name
Go
Wildcards in the pattern for http.HandleFunc
Regex
Go
Go StartsWith(str string)
String
Go
Startswith
Trim string's suffix or extension?
String
Go
Is there no XOR operator for booleans in golang?
Go
Operators
Logical Operators
Xor
Get exit code - Go
Go
Basic HTTP Auth in Go
Go
Basic Authentication
function for converting a struct to map in Golang
Go
What are the differences in outcome for panic vs log.Fatalln()?
Go
How to build executable with name other than Golang package
Go
Build
Package
Naming Conventions
When to use []byte or string in Go?
String
Bytearray
Go
Check for nil and nil interface in Go
Go
Go templates: How do I access array item (arr[2]) in templates?
Templates
Go
Beego
How to remove all contents of a directory using Golang?
Go
server returned error on SASL authentication step: Authentication failed
Mongodb
Authentication
Go
Mgo
How to implement resizable arrays in Go
Go
"Unknown escape sequence" error in Go
Regex
Syntax
Go
Does any golang interactive debugger exist?
Debugging
Go
How to use RWMutex?
Go
How to get error message in a string in golang?
Go
Golang : Is conversion between different struct types possible?
Struct
Go
Can Golang multiply strings like Python can?
Python
String
Python 3.x
Go
golang append() evaluated but not used
Arrays
Go
Var
How to get a MD5 hash from a string in Golang?
Cryptography
Md5
Go
Idiomatic way to do conversion/type assertion on multiple return values in Go
Casting
Go
Return Value
go run: cannot run non-main package
Go
Google App-Engine-Go
Go error: non-constant array bound
Go
Map with concurrent access
Map
Go
Mutex
JSON and dealing with unexported fields
Json
Go
Terminating a Process Started with os/exec in Golang
Go
Setting cookies with net/http
Cookies
Go
How can I open files relative to my GOPATH?
Go
Filepath
Non-declaration statement outside function body in Go
Variables
Scope
Go
Package
Global
can't load package: package .: no buildable Go source files
Go
What is the meaning of "dot parenthesis" syntax?
Go
Syntax
Type Assertion
Language Concepts
Go isn't linking my assembly: undefined external function
Assembly
Go
Slices of structs vs. slices of pointers to structs
Performance
Go
Slice
Testing a gRPC service
Go
Grpc
Does Go have "if x in" construct similar to Python?
If Statement
Go
Whats the difference of functions and methods in Go?
Function
Methods
Go
Skip some tests with go test
Testing
Go
What does 'incompatible' in go.mod mean, will it cause harm?
Go
Go Modules
Is there a queue implementation?
Go
Queue
Fifo
What language is the compiler of Go programming language written in?
Go
How to multiply duration by integer?
Go
Time
Dynamically initialize array size in go
Arrays
Go
Showing custom 404 error page with standard http package
Go
How to iterate through a map in Golang in order?
Go
How Can I Make the Go HTTP Client NOT Follow Redirects Automatically?
Http
Rest
Redirect
Go
How to check if a map is empty in Golang?
Go
Hashmap
Difference between two time.Time objects
Datetime
Go
Time
What should be the values of GOPATH and GOROOT?
Go
Gopath
go test can't find function in a same package
Go
How to test http calls in Go using httptest
Http
Go
Why does fmt.Println inside a goroutine not print a line?
Go
Cannot set $GOPATH on Mac OSX
Macos
Go
Environment Variables
Is Scala's actors similar to Go's coroutines?
Scala
Go
How to convert a 'string pointer' to a string in Golang?
String
Pointers
Go
Type Conversion
Call has possible formatting directive
Go
breaking out of a select statement when all channels are closed
Go
Encode / decode URLs
Url
Escaping
Go
Avoid checking if error is nil repetition?
Go
Exit with error code in go?
Error Handling
Go
Exit
Unmarshaling json in Go: required field?
Json
Go
How to run all .go files within current directory through the command line (multi file package)
Go
Command Line-Interface
Just run single test instead of the whole suite?
Go
What is the correct way to find the min between two integers in Go?
Go
How to generate a random string of a fixed length in Go?
String
Random
Go
How to fmt.Printf an integer with thousands comma
String
Go
Formatting
Printf
Combine URL paths with path.Join()
Url
Go
Path
Composite literal uses unkeyed fields
Mongodb
Go
Create a map of string to List
Go
slice of struct != slice of interface it implements?
Go
Error "can't load package: package my_prog: found packages my_prog and main"
Go
Bcrypt password hashing in Golang (compatible with Node.js)?
node.js
Go
Bcrypt
Different ways to pass channels as arguments in function
Concurrency
Go
Channel
How to build a release version binary in Go?
C
Go
Build
Release
What is the best way to test for an empty string in Go?
String
Go
Is Empty
How do I create crossplatform file paths in Go?
File
Io
Directory
Go
How to implement level based logging in golang?
Logging
Go
Iterating over all the keys of a map
Loops
Dictionary
Go
How to test a unexported (private) function in go (golang)?
Unit Testing
Go
What does nil mean in golang?
Go
What is the Advantage of sync.WaitGroup over Channels?
Go
Concurrency
Channel
What does the asterisk do in "Go"?
Go
Casting back to more specialised interface
Go
Checking the equality of two slices
Go
Go Reflect
Parsing date/time strings which are not 'standard' formats
Time
Go
Golang: tests and working directory
Unit Testing
Go
Working Directory
Call a function from another package in Go
Go
Getting GOPATH error "go: cannot use path@version syntax in GOPATH mode" in Ubuntu 16.04
Go
Gopath
Generating the SHA hash of a string using golang
Hash
Go
Is there an easy way to stub out time.Now() globally during test?
Unit Testing
Go
Why use the `go` keyword when calling a function?
Go
How to get a list of values into a flag in Golang?
Go
Difference between := and = operators in Go
Go
Go string to ascii byte array
Go
Byte
Ascii
In Go, how can I convert a struct to a byte array?
Arrays
Struct
Go
Byte
How to format timestamp in outgoing JSON
Json
Time
Formatting
Go
Get name of struct field using reflection
Go
How to access global variables
Variables
Go
Global
Main
What is the meaning of '*' and '&'?
Go
How to compare Go errors
Go
Error Handling
Compare
Nested maps in Golang
Dictionary
Go
Square Bracket
How to set GOPRIVATE environment variable
Go
Environment Variables
Go Modules
The best way to get a string from a Writer
Io
Go
Are channels passed by reference implicitly
Concurrency
Go
Channels
Pass by-Reference
How do I reverse an array in Go?
Go
is it possible to call overridden method from parent struct in Golang?
Oop
Inheritance
Go
Overriding
Catching panics in Golang
Exception Handling
Error Handling
Go
How to get the current timestamp in other timezones in Golang?
Go
Timestamp
Timezone
How to embed files into Go binaries
Go
Binaries
How would you define a pool of goroutines to be executed at once?
Multithreading
Go
Goroutine
Does Golang support variadic function?
Go
Fix "should not use basic type string as key in context.WithValue" golint
Go
Golint
Slice of slices types
Types
Go
Slice
Go Tour Exercise #7: Binary Trees equivalence
Go
How to have an in-place string that updates on stdout
Go
Stdout
Serving static content with a root URL with the Gorilla toolkit
Web Applications
Go
Mux
How can we truncate float64 type to a particular precision?
Floating Point
Go
formatFloat : convert float number to string
Go
Why is *a{...} invalid indirect?
Go
How do goroutines work? (or: goroutines and OS threads relation)
Concurrency
Go
Goroutine
Most idiomatic way to select elements from an array in Golang?
Arrays
Go
Slice
How to convert uint64 to string
String
Go
Type Conversion
Strconv
Go map of functions
Map
Go
Key Value
Func
Go, go get, go install, local packages, and version control
Git
Package
Go
Save and load crypto/rsa PrivateKey to and from the disk
Go
Cryptography
Rsa
Unpack slices on assignment?
Go
All possible GOOS value?
Go
Cross Compiling
How do I (succinctly) remove the first element from a slice in Go?
Go
Queue
How do I pass arguments to my handler
Go
Gorilla
Go: local import in non-local package
Go
Pick a random value from a Go Slice
Random
Go
Slice
Is it possible to initialize slice with specific values?
Go
Slice
If not true (!true)
If Statement
Go
Go Templates
How to avoid annoying error "declared and not used"
Go
Pointer to a map
Pointers
Dictionary
Go
How to set and get fields in struct's method
Struct
Get
Set
Go
How can I generate HTML documents using `godoc`?
Go
Best way to implement global counters for highly concurrent applications?
Concurrency
Go
Is a Go goroutine a coroutine?
Multithreading
Go
Goroutine
Private fields and methods for a struct
Go
Unable to build protobuf to go endpoint
Go
Protocol Buffers
Convert string to integer type in Go?
String
Go
Type Conversion
Contains method for a slice
Go
Slice
What's the difference between "<-chan" and "chan" as a function return type?
Go
Channel
in Golang, what is the difference between json encoding and marshalling
Go
How to read multiple times from same io.Reader
Go
Reader
getpasswd functionality in Go?
Passwords
Stdin
Go
Getpasswd
Why is my webserver in golang not handling concurrent requests?
Go
Access out of loop value inside golang template's loop
Templates
Go
is there a way to create an instance of a struct from a string?
Go
Get an arbitrary key/item from a map
Dictionary
Go
What input will cause golang's json.Marshal to return an error?
Json
Go
Marshalling
When to use pointers
Pointers
Struct
Go
golang convert "type []string" to string
String
Go
Types
String Concatenation
missing go.sum entry for module providing package <package_name>
Go
Go Modules
Buffalo
How can I read from standard input in the console?
Go
Copying all elements of a map into another
Dictionary
Go
Copy
What is most idiomatic way to create an iterator in Go?
Iterator
Go
Getting a slice of keys from a map
Go
Anonymous interface implementation in Golang
Go
Anonymous Types
JSON omitempty With time.Time Field
Json
Go
Time
Struct
Command not found go — on Mac after installing Go
Macos
Go
Zsh
Why are interfaces needed in Golang?
Go
Struct
Interface
Conversion of time.Duration type microseconds value to milliseconds
Go
Time
How do I send a JSON string in a POST request in Go
Json
Rest
Go
Apiary
How best do I keep a long running Go program, running?
Go
Daemon
Goroutine
How to know TCP connection is closed in net package?
Tcp
Go
Go checking for the type of a custom Error
Error Handling
Go
How to check if a slice has a given index in Go?
Go
Slice
Does a type assertion / type switch have bad performance / is slow in Go?
Casting
Go
Type Conversion
Type Assertion
Assigning null to JSON fields instead of empty strings
Go
Golang method with pointer receiver
Go
Installed Go binary not found in path on Alpine Linux Docker
Linux
Go
Docker
Alpine
Correct way to initialize empty slice
Arrays
Go
Slice
context.WithValue: how to add several key-value pairs
Go
Concurrency
Goroutine
How to convert byte array to string in Go
Go
Types
Sha1
Use of defer in Go
Go
Where does go get install packages?
Go
Homebrew
Removing packages installed with go get
Go
How do I configure go command to use a proxy?
Go
Convert an integer to a byte array
Go
Type Conversion
How to debug "exit status 1" error when running exec.Command in Golang
Error Handling
Command
Go
Exec
Why does the use of an unbuffered channel in the same goroutine result in a deadlock?
Concurrency
Go
Channels
How to escape back ticks
Go
Can Go's `flag` package print usage?
Go
How to know a buffered channel is full
Go
Channel
Why would a call to fmt.Sprint(e) inside the Error() method result in an infinite loop?
Go
One-liner to transform []int into string
Go
unknown field in struct literal
Go
How can I read a header from an http request in golang?
Go
In Go, how do I capture stdout of a function into a string?
Go
Stdout
What's the point of one-way channels in Go?
Go
Setting up proxy for HTTP client
Http
Proxy
Request
Go
Add GoLang syntax highlighting for VIM
Vim
Go
Vim Plugin
Vim Syntax-Highlighting
How to remove items from a slice while ranging over it?
Go
How to remove the last element from a slice?
Go
Postgres drop database error: pq: cannot drop the currently open database
Postgresql
Go
Singleton in go
Design Patterns
Go
Singleton
Anti Patterns
Why would return parameters be named?
Go
Return
Return Value
copy pointer values *a = *b in golang
Go
Always have x number of goroutines running at any time
Go
Goroutine
Initialize nested struct definition
Struct
Go
Initialization
Can command line flags in Go be set to mandatory?
Go
Command Line-Interface
Command Line-Arguments
MINGW64 "make build" error: "bash: make: command not found"
Bash
Go
Makefile
Mingw
Glide Golang
Do Go switch/cases fallthrough or not?
Go
Switch Statement
Fall Through
How does shared memory vs message passing handle large data structures?
Memory
Concurrency
Erlang
Parallel Processing
Go
Can we have function pointers in Go?
Go
How to read/write from/to a file using Go
File
Go
go get results in 'terminal prompts disabled' error for github private repo
Git
Go
How to cast to a type alias in Go?
Types
Casting
Go
Go time.Now() is always 2009-11-10 23:00:00 +0000 UTC
Datetime
Time
Go
How to strings.Split on newline?
Go
How to handle configuration in Go
Go
Configuration Files
How to read a YAML file
Go
Yaml
How to get yesterday's date in golang?
Go
Time
How to append a character to a string in Golang?
String
Go
Concat
Golang Cast interface to struct
Go
Redis
invalid recursive type in a struct in go
Go
How to remove the last character of a string in Golang?
String
Go
How to implement inter-process communication in Go?
Ipc
Go
Convert between slices of different types
Go
Go Reflect
Set UserAgent in http request
Http Headers
Go
How to set the go timeout flag on "Go test"
Testing
Go
Hiding nil values, understanding why Go fails here
Pointers
Go
Interface
Null
How do I SET the GOPATH environment variable on Ubuntu? What file must I edit?
Linux
Ubuntu
Go
`docker-compose up` times out with UnixHTTPConnectionPool
Go
Docker
Docker Compose
Cannot assign to struct field in a map
Go
How to fix parsing go.mod module declares its path as "x" but was required as "y"
Go
Is there a difference between new() and "regular" allocation?
Go
How to generate hash number of a string in Go?
Hash
Go
Why isn't my Stringer interface method getting invoked? When using fmt.Println
Go
Golang struct calling embedded type methods when method has been overloaded
Go
Passing an array as an argument in golang
Arrays
Go
Arguments
How do I create an executable from Golang that doesn't open a console window when run?
Console
Go
How to pass variable length arguments as arguments on another function in Golang?
Function
Go
Variadic Functions
mixture of field:value and value initializers
Go
How to use Go with a private GitLab repo
Git
Go
Get
Package
Gitlab