Category "go"

grpc.WithInsecure is deprecated: use insecure.NewCredentials() instead

Hey I'm trying make a small test client with Go and Grpc, opts := grpc.WithInsecure() cc, err := grpc.Dial("localhost:9950", opts) if err != nil {

Adding hours, minutes, seconds to current time

How do I add hours, minutes, and seconds (defined as ints) to the current time, similar to AddDate? timein := time.Now().Local().AddDate(Hours, Mins, Sec) bu

Golang build error 0x80000034 (2147483700)

command I ran: go build -o main output: /usr/local/go/pkg/tool/darwin_arm64/link: /usr/local/go/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load

How to make a nullable field in a struct

I'm struggling to do table driven test, and I want do this: testCases := []struct { name string testUserID uint expected User // &

Golang MySQL error - packets.go:33: unexpected EOF

I am switching my entire code base from PHP to Go and during several processes that run, I randomly get this error: [mysql] 2016/10/11 09:17:16 packets.go:33:

Correct way to provide minimal browser-api to Go wasm and returning lib-api back to client, without Global scope?

I'm trying to find a best/right way to implement minimal and safe client <-> wasm api while avoiding usage of window|global|self context. I have found 3 w

stderr: $GOPATH/go.mod exists but should not failed to load view for file:///Users/xxx

I am using vscode and vscode-go to develop the Go application. When I try to restart language server using command + shirt + p and select "Go: Restart Languag

How do I construct an object of a slice struct?

package main import ( "fmt" ) type demo []struct { Text string Type string } func main() { d := demo{ Text: "Hello", Type:

Golang gin gonic web framework proxy route to another backend

How to reverse proxy web requests for a few routes to another backend in Gin Gonic web golang framework Is there a way to directly forward in the Handle functi

How to set scope for token in Google Play Developer Reporting API

I started to use Google Play Developer Reporting API with using Golang(https://pkg.go.dev/google.golang.org/[email protected]/playdeveloperreporting/v1beta1), and fac

Fixing import cycle in Go

So I have this import cycle which I'm trying to solve. I have this following pattern: view/ - view.go action/ - action.go - register.go And the general idea

Move a file to a different drive with Go

I'm trying to move a file from my C-drive to my H-drive using os.Replace(). The code looks as follows: func MoveFile(source string, destination string) {

Some questions regarding $GOPATH

I'm a new golang developer and I wonder why $GOPATH environment variable is needed to be set at the root of my project. If I'm working on several projects at t

Returning JSON data as a stream per chunk to Angular2 or jQuery over HTTP2 (HTTPS)

In one of my API's I mostly return a result (let's say paged 50 results) as one whole in an json array like so: [{},{},{},{},{},...] I was wondering if there

Is there a way to update the TLS certificates in a net/http server without any downtime?

I have a simple https server serving a simple page like so (no error handling for brevity): package main import ( "crypto/tls" "fmt" "net/http" )

How to read TCP packets on a tun/tap interface?

I'm working on a simple project that listens on a tun interface and modified the packets then re-sends them to the real interface. I have tried songgao/water,

how to install a package with gvm(Go Version Manager)? go get failed

I successfully installed go1.6.2 with gvm and used global pkgset. I am trying to install gocode package with gvm, but go get not working. I guess gvm is not rea

net/rpc server stay registered when running test more than once with the 'count' flag

The program creates a rpc server and a client and expose several methods via the rpc interface. Several test functions testing one of the methods each. The firs

How do I print a 2-Dimensional array as a grid in Golang?

The 2D Array I am trying to print as a board Note: I am a complete novice at using Go and need this for a final project. I am making an attempt to make the game

How initialize the result of groupArray function of the ClickHouse to the array

In my Go application, I make a request to the ClickHouse database via clickhouse-go package. This query which I make return always only one record and it's an a