2022-07-15 15:32:10 +02:00
//golangcitest:args -Egomodguard
//golangcitest:config_path testdata/configs/gomodguard.yml
2020-04-04 15:29:11 -04:00
package testdata
import (
"log"
"golang.org/x/mod/modfile"
2022-08-20 18:53:45 +02:00
"gopkg.in/yaml.v3" // want "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."
2020-04-04 15:29:11 -04:00
)
// Something just some struct
type Something struct { }
2022-08-21 21:37:47 +02:00
func aAllowedImport ( ) { //nolint:unused
2020-04-04 15:29:11 -04:00
mfile , _ := modfile . Parse ( "go.mod" , [ ] byte { } , nil )
log . Println ( mfile )
}
2022-08-21 21:37:47 +02:00
func aBlockedImport ( ) { //nolint:unused
2020-04-04 15:29:11 -04:00
data := [ ] byte { }
something := Something { }
_ = yaml . Unmarshal ( data , & something )
log . Println ( data )
}