golangci-lint/test/testdata/gomodguard.go
Ludovic Fernandez fcef82475c
docs: improve linters page (#1995)
* TOC level 3
* drop `.golangci.yaml` from the Configuration page
* generate a dedicated configuration section for each linters.
* fix changelog heading
2021-05-17 23:56:46 +02:00

28 lines
698 B
Go

//args: -Egomodguard
//config_path: testdata/configs/gomodguard.yml
package testdata
import (
"log"
"golang.org/x/mod/modfile"
"gopkg.in/yaml.v3" // ERROR "import of package `gopkg.in/yaml.v3` is blocked because the module is in the blocked modules list. `github.com/kylelemons/go-gypsy` is a recommended module. This is an example of recommendations."
)
// Something just some struct
type Something struct{}
func aAllowedImport() { // nolint: deadcode,unused
mfile, _ := modfile.Parse("go.mod", []byte{}, nil)
log.Println(mfile)
}
func aBlockedImport() { // nolint: deadcode,unused
data := []byte{}
something := Something{}
_ = yaml.Unmarshal(data, &something)
log.Println(data)
}