github.com/nozzle/golangci-lint@v1.49.0-nz3/test/testdata/gosec_severity_confidence.go (about)

     1  //golangcitest:args -Egosec
     2  //golangcitest:config_path testdata/configs/gosec_severity_confidence.yml
     3  package testdata
     4  
     5  import (
     6  	"fmt"
     7  	"io/ioutil"
     8  	"net/http"
     9  )
    10  
    11  var url string = "https://www.abcdefghijk.com"
    12  
    13  func gosecVariableURL() {
    14  	resp, err := http.Get(url) // want "G107: Potential HTTP request made with variable url"
    15  	if err != nil {
    16  		panic(err)
    17  	}
    18  	defer resp.Body.Close()
    19  	body, err := ioutil.ReadAll(resp.Body)
    20  	if err != nil {
    21  		panic(err)
    22  	}
    23  	fmt.Printf("%s", body)
    24  }
    25  
    26  func gosecHardcodedCredentials() {
    27  	username := "admin"
    28  	var password = "f62e5bcda4fae4f82370da0c6f20697b8f8447ef"
    29  
    30  	fmt.Println("Doing something with: ", username, password)
    31  }