Quantcast
Channel: User Oleg Butuzov - Stack Overflow
Browsing index pages (39 articles)
↧

Answer by Oleg Butuzov for How to sort a slice of string

You need to compare each item separatelysort.SliceStable(rows, func(i, j int) bool { var hour_i, min_i, sec_i int var hour_j, min_j, sec_j int fmt.Sscanf(rows[i], "%d:%d:%d", &hour_i, &min_i,...

View Article


Answer by Oleg Butuzov for VSCode: how to run yapf to format on save the file

You might want to use eeyore.yapf VSCode extension along side yapf available to your editor via $PATH (I am usually just keep virtual env within code).Configuration is available in .style.yapf you can...

View Article


Terraform Provider Development: tfstate updated even if update fails

So I was curious how to develop terraform providers and runned into an issue i cannot explain.My CRUD pretty simple, I Create resource and Updating its meta data during lifespan, and Deleting it on...

View Article

Performance: Sorting Slice vs Sorting Type (of Slice) with Sort implementation

I was playing with some code challenges and found that custom sort (implementation of sort interface) work much faster than just for raw structure of slices. Why is that? Does slice conversion to type...

View Article

Answer by Oleg Butuzov for go exec command security linting messages using...

Hardcode a command call. There are no other options AFAIS.Update: starting from version 1.40 you gosec options are customizable, see example config .golangci.example.yml in...

View Article


Make last paragraph - active pointer

I am trying to write my research work in markdown, and it's required by my institution to submit it in Word doc format. I decided to use python-docx package to automate this task.However, I am...

View Article

Answer by Oleg Butuzov for How to have multiple object types in a single...

you can split yaml documents by adding on a new line---see https://yaml.org/spec/1.2/spec.html#id2760395

View Article

Answer by Oleg Butuzov for how to update brew formula when i update the...

You can automate it with goreleaser help - see brewhere is a configuration example of how it can be used with goreleaser (note it's referring to the private repository).brews: - name: app-cli homepage:...

View Article


Answer by Oleg Butuzov for Scraping $nbsp with go

It's not really clear what you need to %%some_words%% is what in HTML, it's replaced by javascript on page load.You might want to check rec_template_replaces in js of that page, and find the values you...

View Article


Answer by Oleg Butuzov for Can you explain the behavior of this Go pointer...

Only this line needs to be explainedy := *xand it means to take value from this pointer (*x) and assign it to y, now y has a freshly non connected to x value.

View Article

Answer by Oleg Butuzov for Connect kafka in go(sarama), the consumer can not...

I believe you are not wating for the messages to come...here is the list fo issues you have in your code:defer pc.AsyncClose() will trigger on function exit, not scope exit.goroutine is launching into...

View Article

Answer by Oleg Butuzov for Unable to exec -it into the container

FROM golang:1.13.8-alpine3.11 as build-envWORKDIR /appCOPY *.go /appRUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o docker-simple-appFROM scratchWORKDIR /appCOPY --from=build-env...

View Article

Answer by Oleg Butuzov for start a child span from an existing parent span in Go

Have you tried to span.StartChild("foobar") ? (I am judging based on sentry sdk)

View Article


Headers propagation to upstream services in Istio

I would like to pass header foo from service A to service B, but how to do that?VirtualService's header will work only with actual virtual service and wouldn't be passed to service B (as I would...

View Article

Answer by Oleg Butuzov for What are the kubernetes pod phases equivalence to...

Kubernetes is setting a Status to the pod (so status is Primary), status itself can have Phase.So for example StatusCompleted can be assigned to Phase Succeeded and Phase Failed, While StatusRunning...

View Article


Answer by Oleg Butuzov for Stop time.NewTimer initialized inside for loop

if you use context instead of timer, Where cancel only called when exiting function case condition.package mainimport ("context""fmt""time")func main() { ch := make(chan string) go endProgram(ch)...

View Article

Answer by Oleg Butuzov for JSON omitempty omitting non-empty values

You have a struct tags repeated - linter go-vet message in the example https://play.golang.org/p/Um5M1R4DZ49 . Once you place unique values (like user and pass) everything will workThis is correct (not...

View Article


Answer by Oleg Butuzov for Go validation using envoy proxy validator and gogo...

you missed \ after get-validate and later...protoc \--proto_path=${GOPATH}/src \--proto_path=${GOPATH}/pkg/mod/github.com/gogo/protobuf@v1.3.2...

View Article

Answer by Oleg Butuzov for Is it possible to present an embedded file as a...

Filename that Key accept as string argument is only abstraction on ioutil.ReadFile, see auth.goWhat you can do is implement ssh.Auth yourself, here is small example.package mainimport ( _...

View Article

Answer by Oleg Butuzov for How can I put a format specifier in Elasticsearch...

Using fmt.Sprintf may be the simplest way to do that, not the fastest. but simplest.d := 123id := fmt.Sprintf(`{"query": {"match": {"id": %d}}}`, d)

View Article
Browsing index pages (39 articles)


Latest Images