Category "go"

traefik.go: command traefik error: failed to eval New: undefined: xxx

I am trying to build a Traefik plugin and test it in local mode based on https://github.com/traefik/plugindemo#local-mode Right now this plugin does nothing and

traefik.go: command traefik error: failed to eval New: undefined: xxx

I am trying to build a Traefik plugin and test it in local mode based on https://github.com/traefik/plugindemo#local-mode Right now this plugin does nothing and

Private embedded struct when importing a struct from another package

I have a project which relies on a struct imported from another package, which I will call TheirEntity. In the example below, I (ahem) embed TheirEntity in MyE

How to remove all contents of a directory using Golang?

I'm new to Go and can't seem to find a way to delete all the contents of a directory when I don't know the contents. I've tried: os.RemoveAll("/tmp/*") os.Rem

Couldn't start dlv dap

When I launch in VSCode dlv dap debug, I get this message: Couldn't start dlv dap: Error:timed out while waiting for DAP server to start I already have launch

tls: no renegotiation error on HTTP request

I'm trying to make a simple HTTP request in Go, after directly following the guides I keep getting the same error: local error: tls: no renegotiation I don't

Google Stackdriver log entry record field logging.googleapis.com/severity vs severity

I have a general log package that wraps logs for Stackdriver- Gets context, severity etc and transform it to LogEntry i.e: func Log(ctx context.Context, severi

Golang multi-method interface and struct naming

Golang docs provide a clear guidance on how to name single-method interface (by appending "-er"). But what is the best practice to name a multi-method interface

Pointer receiver method compilation problem: Cannot call a pointer method on 'MyObj{}'

I have the following method defined: func (o *MyObj) parse(something string) string { // Do stuff } This code (1) compiles just fine: (&MyObj{}).parse(

Multiple receivers on a single channel. Who gets the data?

Unbuffered channels block receivers until data is available on the channel. It's not clear to me how this blocking behaves with multiple receivers on the same c

go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1 /usr/bin/ld: cannot find -lgdal

I am trying to run go build on my sources. go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1 /usr/bin/ld: cannot find -lgdal collect2: error: ld

How to set TLS cipher for Go server?

I'm currently using the following listen and serve command to run a secure websocket/file server: http.ListenAndServeTLS(":443", "site.crt","site.key", router)

casting overlapping structs in golang

I'm new to golang and trying to figure out the correct way of casting a block of bytes to the correct struct. All structs start with two bytes that dictate the

When debugging, GoLand can not evaluate a function on M1

When debugging, use the Evaluate expression and try to evaluate a function. The result is shown as: "backend does not support function calls". Why? MacBook Pro

How do I do a literal *int64 in Go?

I have a struct type with a *int64 field. type SomeType struct { SomeField *int64 } At some point in my code, I want to declare a literal of this (say, w

How do you deal with wall-clock times without date in Go?

I'd like to know if there is any existing package to deal with datetimes without date in Golang. The problem is as follows. Imagine I want to store information

How can I install a package with go get?

I want to install packages from github to my $GOPATH, I have tried this: go get github.com:capotej/groupcache-db-experiment.git the repository is here.

Can I change default compiler used by cgo?

I am trying to execute cgo code under ubuntu 14.04, it seems like cgo assume CC/CXX to be gcc/g++. And I need to explicitly specify CC/CXX in order to use, say,

Golang: what is atomic read used for?

Here we have a go case provided by Go by Example, to explain the atomic package. https://gobyexample.com/atomic-counters package main import "fmt" import "ti

gRPC server blocked on SendMsg

We're having an issue where our gRPC streaming server is blocked on SendMsg with the following stack trace: google.golang.org/grpc/internal/transport.(*writeQuo