Golang coverprofile output format

Issue I’m trying to make sense of the -coverprofile cover.out option in go test, specifically the format of the file. Covering server.go for example, yields the output in cover.out: mode: set github.com/cnuss/api_server/server.go:47.2,48.16 2 0 github.com/cnuss/api_server/server.go:52.2,53.16 2 0 github.com/cnuss/api_server/server.go:57.2,58.16 2 0

Continue reading

Stripe Webhooks Testing in Go

Issue How can I mock the requests from Stripe to my webhooks with Stripe’s Go library? The Node library has the stripe.webhooks.generateTestHeaderString method that allows to mock such requests: const payload = { id: ‘evt_test_webhook’, object: ‘event’, }; const payloadString

Continue reading

Golang testing: "no test files"

Issue I’m creating a simple test within my package directory called reverseTest.go package main import “testing” func TestReverse(t *testing.T) { cases := []struct { in, want string }{ {“Hello, world”, “dlrow ,olleH”}, {“Hello, δΈ–η•Œ”, “η•ŒδΈ– ,olleH”}, {“”, “”}, } for

Continue reading