2023-11-25 22:51:38 +00:00
|
|
|
package testutils
|
|
|
|
|
|
|
|
import "github.com/securego/gosec/v2"
|
|
|
|
|
2023-12-08 13:30:54 +00:00
|
|
|
// SampleCodeG108 - pprof endpoint automatically exposed
|
|
|
|
var SampleCodeG108 = []CodeSample{
|
|
|
|
{[]string{`
|
2023-11-25 22:51:38 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
"net/http"
|
|
|
|
_ "net/http/pprof"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
|
|
|
fmt.Fprintf(w, "Hello World!")
|
|
|
|
})
|
|
|
|
log.Fatal(http.ListenAndServe(":8080", nil))
|
|
|
|
}
|
|
|
|
`}, 1, gosec.NewConfig()},
|
2023-12-08 13:30:54 +00:00
|
|
|
{[]string{`
|
2023-11-25 22:51:38 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
|
|
|
fmt.Fprintf(w, "Hello World!")
|
|
|
|
})
|
|
|
|
log.Fatal(http.ListenAndServe(":8080", nil))
|
|
|
|
}
|
|
|
|
`}, 0, gosec.NewConfig()},
|
2023-12-08 13:30:54 +00:00
|
|
|
}
|