Importing `"<http://github.com/pact-foundation/pac...
# pact-go
é
Importing
"<http://github.com/pact-foundation/pact-go/v2/sugar|github.com/pact-foundation/pact-go/v2/sugar>"
and running the linter I got this error:
Copy code
golangci-lint run --skip-dirs cmd/pactgoconsumerexample_tester
WARN [runner] Can't run linter goanalysis_metalinter: inspect: failed to load package sugar: could not load export data: no export data for "<http://github.com/pact-foundation/pact-go/v2/sugar|github.com/pact-foundation/pact-go/v2/sugar>" 
ERRO Running error: 1 error occurred:
	* can't run linter goanalysis_metalinter: inspect: failed to load package sugar: could not load export data: no export data for "<http://github.com/pact-foundation/pact-go/v2/sugar|github.com/pact-foundation/pact-go/v2/sugar>"
m
Do you know what a possible remedy is for it?
é
nope
m
Can you please raise an issue? I'll have to investigate
👌 1
It might be because it only contains aliases
é
m
ty
é
This issue seems similar, but my lack of acquaintance with
go
is limiting my understanding of the solution https://github.com/golangci/golangci-lint/issues/2280
It's talking about
can't run linter goanalysis_metalinter: buildir
while my issue is
can't run linter goanalysis_metalinter: inspect
Not sure how relevant that is
@Matt (pactflow.io / pact-js / pact-go) would you mind having a look at https://github.com/golangci/golangci-lint/issues/2788 ? The author of
golangci-lint
mention you are using
CGO
and not
go
m
The author of
golangci-lint
mention you are using
CGO
and not
go
(edited)
we have to use CGO, because we rely on and link to a shared library.
Does the linter not support CGo libraries? 🤔
w
Did we come to a conclusion?
m
I don’t think so, but I’m going to kill the sugar package anyway
that’s my conclusion 😉
w
My issue isn't linked to the sugar package but it's something like:
Copy code
"[runner] Can't run linter goanalysis_metalinter: buildir: failed to load package native: could not load export data: no export data for \"<http://github.com/pact-foundation/pact-go/v2/internal/native\|github.com/pact-foundation/pact-go/v2/internal/native\>""
m
cool. I have no idea what it means on what to do about it, but happy to fix it if you know what it is
I suspect it could be unhappy about it being CGo (we have a native dependency)
w
Yeah i am not entirely sure what it means either but i will take a look.
👍 2
Any ideas on how to debug this?
m
you could run the linter on a local version of pact go, and remove/change code until it stops complaining
and then you’ll know which bit it doesn’t like
w
the linter doesn't fail locally in my repo, just on the github ci/cd runner
but i will clone the pact-go repo and run the linter to see
just did this and locally golangci-lint did not complain. Is there a difference between github actions golangci-lint and the local one? I am using the same version
m
🤷‍♂️
w
So v1.41.1 of golangci-lint works
👍 1
but v1.46.2 does not
🙌 1
m
I don't use this tool, I'm happy to support a fix but my guess is it's an issue with the linter or it needs Pact Go to be configured with e.g. an ignore rule They'll need a minimal reproducible example to be able to fix tho
w
Currently incrementing each version to see the main culprit
and what changes were implemented that affected that
V1.42.0 seems to be the last working version with go1.18. After that it fails
So the fix was to install pact_go for the ci/cd runner and run the lint
m
interesting
w
when i put pact_go into a docker image and called that image in the github runner, it worked
m
which say install, do you mean something like
pact-go install
? or installing the package via
go get
or something?
w
i have both go get and and pact-go install
m
Perhaps it needs the ffi lib to be on it (e.g
libpact_ffi.so
)
that’s…. bizarre
w
yeah it most likely is the need for a ffi lib
i probably don't need both but i added both just so i didn't have to go backwards and forward
i will dig deeper
🙏 1
m
but doing either of the things above you listed doesn’t do that, so that’s fasctinating
great work