apache_exporter icon indicating copy to clipboard operation
apache_exporter copied to clipboard

Compilation error with Docker

Open NPellet opened this issue 3 years ago • 3 comments

I tried to follow the instructions, but...

$ docker run --rm -v $(pwd):/usr/local/go/src/github.com/Lusitaniae/apache_exporter -w /usr/local/go/src/github.com/Lusitaniae/apache_exporter golang:bullseye make
>> checking code style
>> checking license header
mkdir -p /go/bin
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/v1.39.0/install.sh \
        | sed -e '/install -d/d' \
        | sh -s -- -b /go/bin v1.39.0
golangci/golangci-lint info checking GitHub for tag 'v1.39.0'
golangci/golangci-lint info found version: 1.39.0 for v1.39.0/linux/amd64
golangci/golangci-lint info installed /go/bin/golangci-lint
>> running golangci-lint
GO111MODULE=on go list -e -compiled -test=true -export=false -deps=true -find=false -tags= -- ./... > /dev/null
go: downloading github.com/go-kit/log v0.2.0
go: downloading github.com/prometheus/common v0.29.0
go: downloading github.com/prometheus/client_golang v1.11.0
go: downloading github.com/prometheus/exporter-toolkit v0.7.0
go: downloading gopkg.in/alecthomas/kingpin.v2 v2.2.6
go: downloading github.com/go-logfmt/logfmt v0.5.1
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
go: downloading github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d
go: downloading gopkg.in/yaml.v2 v2.4.0
go: downloading golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e
go: downloading golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c
go: downloading golang.org/x/net v0.0.0-20210525063256-abc453219eb5
go: downloading github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f
go: downloading github.com/prometheus/client_model v0.2.0
go: downloading github.com/golang/protobuf v1.4.3
go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.1
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/cespare/xxhash/v2 v2.1.1
go: downloading github.com/prometheus/procfs v0.6.0
go: downloading github.com/jpillora/backoff v1.0.0
go: downloading google.golang.org/protobuf v1.26.0-rc.1
go: downloading golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1
go: downloading golang.org/x/text v0.3.6
GO111MODULE=on /go/bin/golangci-lint run  ./...
apache_exporter.go:40:21: undeclared name: `kingpin` (typecheck)
        listeningAddress = kingpin.Flag("telemetry.address", "Address on which to expose metrics.").Default(":9117").String()
                           ^
apache_exporter.go:41:21: undeclared name: `kingpin` (typecheck)
        metricsEndpoint  = kingpin.Flag("telemetry.endpoint", "Path under which to expose metrics.").Default("/metrics").String()
                           ^
apache_exporter.go:42:21: undeclared name: `kingpin` (typecheck)
        scrapeURI        = kingpin.Flag("scrape_uri", "URI to apache stub status page.").Default("http://localhost/server-status/?auto").String()
                           ^
apache_exporter.go:32:2: "gopkg.in/alecthomas/kingpin.v2" imported but not used (typecheck)
        "gopkg.in/alecthomas/kingpin.v2"
        ^
make: *** [Makefile.common:192: common-lint] Error 1

NPellet avatar Apr 04 '22 10:04 NPellet

Compiling with a previous version of Go (golang:1.17-bullseye) seems to work. It fails the tests, but it succeeds in producing the binary.

drmalex07 avatar May 06 '22 23:05 drmalex07

It's probably a firewall issue failing to fetch the deps, I'll check it out

On Sat, 7 May 2022, 01:12 MichailAlexakis, @.***> wrote:

Compiling with a previous version of Go (golang:1.17-bullseye) seems to work. It fails the tests, but it succeeds in producing the binary.

— Reply to this email directly, view it on GitHub https://github.com/Lusitaniae/apache_exporter/issues/132#issuecomment-1120069534, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALKLW4KEMXMN3USVLF2UD3VIWROXANCNFSM5SPBERSQ . You are receiving this because you authored the thread.Message ID: @.***>

NPellet avatar May 07 '22 08:05 NPellet

I have the same issue on a system with go 1.18. It looks like golangci-lint does not handle kingpin well at the moment.

The included Makefile.common uses v1.39.0 of golangci-lint so setting it to a newer one, e.g.

export GOLANGCI_LINT_VERSION=v1.46.2

(and clearing my $HOME/go to have the new version installed) at least made it produce a binary which can be started.

Please be aware that the tests are still failing:

$ export GOLANGCI_LINT_VERSION=v1.46.2
$ make
>> checking code style
>> checking license header
mkdir -p /home/saschal/go/bin
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/v1.46.2/install.sh \
	| sed -e '/install -d/d' \
	| sh -s -- -b /home/saschal/go/bin v1.46.2
golangci/golangci-lint info checking GitHub for tag 'v1.46.2'
golangci/golangci-lint info found version: 1.46.2 for v1.46.2/linux/amd64
golangci/golangci-lint info installed /home/saschal/go/bin/golangci-lint
>> running golangci-lint
GO111MODULE=on go list -e -compiled -test=true -export=false -deps=true -find=false -tags= -- ./... > /dev/null
go: downloading github.com/prometheus/client_golang v1.12.2
go: downloading github.com/go-kit/log v0.2.1
go: downloading github.com/prometheus/common v0.34.0
go: downloading github.com/prometheus/exporter-toolkit v0.7.1
go: downloading gopkg.in/alecthomas/kingpin.v2 v2.2.6
go: downloading github.com/go-logfmt/logfmt v0.5.1
go: downloading github.com/pkg/errors v0.9.1
go: downloading golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e
go: downloading gopkg.in/yaml.v2 v2.4.0
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/cespare/xxhash/v2 v2.1.2
go: downloading github.com/golang/protobuf v1.5.2
go: downloading github.com/prometheus/client_model v0.2.0
go: downloading github.com/prometheus/procfs v0.7.3
go: downloading google.golang.org/protobuf v1.28.0
go: downloading github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
go: downloading github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137
go: downloading github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f
go: downloading golang.org/x/net v0.0.0-20220617184016-355a448f1bc9
go: downloading golang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb
go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.1
go: downloading github.com/jpillora/backoff v1.0.0
go: downloading golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c
go: downloading golang.org/x/text v0.3.7
GO111MODULE=on /home/saschal/go/bin/golangci-lint run  ./...
>> running check for unused/missing packages in go.mod
GO111MODULE=on go mod tidy
go: downloading github.com/stretchr/testify v1.4.0
go: downloading gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15
go: downloading github.com/google/go-cmp v0.5.5
go: downloading github.com/kr/pretty v0.1.0
go: downloading google.golang.org/appengine v1.6.7
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading github.com/kr/text v0.1.0
go: downloading golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
curl -s -L https://github.com/prometheus/promu/releases/download/v0.12.0/promu-0.12.0.linux-amd64.tar.gz | tar -xvzf - -C /tmp/tmp.7V0KL5OVNK
promu-0.12.0.linux-amd64/
promu-0.12.0.linux-amd64/LICENSE
promu-0.12.0.linux-amd64/NOTICE
promu-0.12.0.linux-amd64/promu
mkdir -p /home/saschal/go/bin
cp /tmp/tmp.7V0KL5OVNK/promu-0.12.0.linux-amd64/promu /home/saschal/go/bin/promu
rm -r /tmp/tmp.7V0KL5OVNK
>> building binaries
GO111MODULE=on /home/saschal/go/bin/promu build --prefix /home/saschal/SOFTWARE/apache_exporter 
 >   apache_exporter
>> running all tests
GO111MODULE=on go test -race  ./...
ok  	github.com/Lusitaniae/apache_exporter	(cached)
?   	github.com/Lusitaniae/apache_exporter/collector	[no test files]
>> vetting code
GO111MODULE=on go vet  ./...
# github.com/Lusitaniae/apache_exporter
./apache_exporter.go:50:2: misuse of unbuffered os.Signal channel as argument to signal.Notify
./apache_exporter.go:51:2: misuse of unbuffered os.Signal channel as argument to signal.Notify
./apache_exporter.go:52:2: misuse of unbuffered os.Signal channel as argument to signal.Notify
./apache_exporter.go:53:2: misuse of unbuffered os.Signal channel as argument to signal.Notify
make: *** [Makefile.common:185: common-vet] Error 2

sluedecke avatar Jun 21 '22 09:06 sluedecke

This should be resolved. Let us know if you can reproduce on master or the latest release.

blkperl avatar Apr 05 '23 21:04 blkperl