Getting error while building docker image

vendor/go.elastic.co/apm/transport/http.go:115:38: undefined: configutil.ParseBoolEnv
vendor/go.elastic.co/apm/transport/http.go:120:35: undefined: configutil.ParseDurationEnv

Im getting this error while building docker image but the ParseBoolEnv and ParseDurationEnv function is in the mentioned path inside the vendor directory

Hi @Hariprasanth_R, welcome to the forum.

go.elastic.co/apm/transport/http.go imports "go.elastic.co/apm/internal/configutil" (see apm-agent-go/transport/http.go at 41de5f09b4be67a9781a9e889a9c249a4c35176d · elastic/apm-agent-go · GitHub).

Does the path go.elastic.co/apm/internal/configutil exist in your vendor folder?

Does running go mod tidy improve the situation?


Background: I got curious, so I tested this locally. I created a go.mod and main.go (see below), then I ran go mod tidy to download all dependencies, then I ran go mod vendor to get all the dependencies into the vendor directory.

At my end, I see go.elastic.co/apm/internal/configutil inside my vendor directory, and go build succeeds.

module vendoring

go 1.20

require go.elastic.co/apm v1.15.0

require github.com/pkg/errors v0.8.1 // indirect
package main

import (
	"log"

	"go.elastic.co/apm/transport"
)

func main() {
	t, err := transport.NewHTTPTransport()
	if err != nil {
		log.Fatal(err)
	}
	t.SetUserAgent("go.elastic.co/apm/transport")
}

Thanks for the reply.
But I to see go.elastic.co/apm/internal/configutil inside my vendor directory and go mod tidy doesn’t seem to give any improvement

This is strange. Is there something special about your build environment? Some settings, restrictions, etc. that would not exist on a typical machine?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.