github.com/confluentinc/confluent-kafka-go/kafka
低版本用 static_all ,高版本用musl,自己编译用dynamic
如果是go build 用 -tags; golangci-lint用 –build-tags
golangci-lint run -v –build-tags=dynamic -j 4
% golangci-lint run WARN [runner] Can’t run linter goanalysis_metalinter: bodyclose: failed prerequisites: [buildssa@views/web: analysis skipped: errors in package: [/Users/xiazemin/go/shimo-views/web/grpc.go:40:2: could not import views/kafkatransport/kconsumer (/Users/xiazemin/go/shimo-views/kafkatransport/kconsumer/consumer.go:8:2: could not import github.com/confluentinc/confluent-kafka-go/kafka (/Users/xiazemin/go/pkg/mod/github.com/confluentinc/confluent-kafka-go@v1.6.1/kafka/00version.go:48:8: could not import C (cgo preprocessing failed)))]] WARN [runner] Can’t run linter unused: buildir: failed to load package kafka: could not load export data: no export data for “github.com/confluentinc/confluent-kafka-go/kafka” ERRO Running error: buildir: failed to load package kafka: could not load export data: no export data for “github.com/confluentinc/confluent-kafka-go/kafka”
golangci-lint -v INFO [config_reader] Used config file ../.golangci.yml
% golangci-lint run –build-tags=musl ../.golangci.yml ./… ERRO [linters context] typechecking error: directory ../.golangci.yml outside available modules WARN [runner] Can’t run linter goanalysis_metalinter: bodyclose: failed prerequisites: [buildssa@../.golangci.yml: analysis skipped: errors in package: [-: directory ../.golangci.yml outside available modules]] WARN [runner] Can’t run linter unused: buildir: analysis skipped: errors in package: [-: directory ../.golangci.yml outside available modules] ERRO Running error: buildir: analysis skipped: errors in package: [-: directory ../.golangci.yml outside available modules]
% cp ../.golangci.yml .golangci.yml % golangci-lint run –build-tags=musl .golangci.yml ./… ERRO [linters context] typechecking error: no required module provides package .golangci.yml; to add it: go get .golangci.yml WARN [runner] Can’t run linter goanalysis_metalinter: bodyclose: failed prerequisites: [buildssa@.golangci.yml: analysis skipped: errors in package: [-: no required module provides package .golangci.yml; to add it: go get .golangci.yml]] WARN [runner] Can’t run linter unused: buildir: analysis skipped: errors in package: [-: no required module provides package .golangci.yml; to add it: go get .golangci.yml] ERRO Running error: buildir: analysis skipped: errors in package: [-: no required module provides package .golangci.yml; to add it: go get .golangci.yml]
% golangci-lint run -v –build-tags=dynamic -j 4