github.com/chenfeining/golangci-lint@v1.0.2-0.20230730162517-14c6c67868df/test/testdata/depguard_additional_guards.go (about)

     1  //golangcitest:args -Edepguard
     2  //golangcitest:config_path testdata/configs/depguard_additional_guards.yml
     3  package testdata
     4  
     5  import (
     6  	"compress/gzip" // want "import 'compress/gzip' is not allowed from list 'main': nope"
     7  	"fmt"           // want "import 'fmt' is not allowed from list 'main': nope"
     8  	"log"           // want "import 'log' is not allowed from list 'main': don't use log"
     9  	"strings"       // want "import 'strings' is not allowed from list 'main': nope"
    10  
    11  	"golang.org/x/tools/go/analysis" // want "import 'golang.org/x/tools/go/analysis' is not allowed from list 'main': example import with dot"
    12  )
    13  
    14  func SpewDebugInfo() {
    15  	log.Println(gzip.BestCompression)
    16  	log.Println(fmt.Sprintf("SpewDebugInfo"))
    17  	log.Println(strings.ToLower("SpewDebugInfo"))
    18  	_ = analysis.Analyzer{}
    19  }