Unable to lint with `GOEXPERIMENT=jsonv2`
question
### Welcome
- [x] Yes, I understand that the GitHub action repository is not the repository of golangci-lint itself.
- [x] Yes, I've searched similar issues on GitHub and didn't find any.
- [x] Yes, I've included all information below (version, config, etc).
### Description of the problem
While I can successfully run v2.10.1 with `GOEXPERIMENT=jsonv2` locally, it fails with `go: unknown GOEXPERIMENT jsonv2` when I run it as a GH Action.
Output:
<details>
```
> Run env
...
GOEXPERIMENT=jsonv2
> Run golangci-lint version
golangci-lint has version 2.10.1 built with go1.26.0 from 5d1e709b on 2026-02-17T15:27:33Z
> Run golangci-lint run
golangci-lint run
shell: /usr/bin/bash -e {0}
env:
GOEXPERIMENT: jsonv2
level=error msg="[formatter] gci: command \"go env -json GOMOD\": exit status 2: "
level=warning msg="[gomod_salt] Failed to calculate go.mod salt: failed to get goenv: command \"go env -json GOMOD\": exit status 2: "
level=warning msg="Failed to discover go env: command \"go env -json GOCACHE GOROOT\": exit status 2: "
level=error msg="Running error: context loading failed: failed to load packages: failed to load packages: failed to load with go/packages: err: exit status 2: stderr: go: unknown GOEXPERIMENT jsonv2\n"
Error: Process completed with exit code 3.
```
</details>
### Version of golangci-lint
v2.10.1
### Version of the GitHub Action
v9
### Workflow file
<details>
```yml
name: "Lint"
on: pull_request
env:
GOEXPERIMENT: jsonv2
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: golangci/golangci-lint-action@v9
with:
install-only: true
- run: env
- run: golangci-lint version
- run: golangci-lint run
```
</details>
### Golangci-lint configuration
none
### Go version
1.26
### Code example or link to a public repository
<details>
```go
package main
import (
"encoding/json/v2"
"fmt"
)
func main() {
bin, err := json.Marshal(map[string]string{"key": "value"})
if err != nil {
panic(err)
}
fmt.Println(string(bin))
}
```
</details>
关闭于 2026-03-06 6 条评论