···11+{ lib, buildGoModule, fetchFromGitHub }:
22+33+buildGoModule rec {
44+ pname = "govulncheck";
55+ version = "unstable-2022-09-02";
66+77+ src = fetchFromGitHub {
88+ owner = "golang";
99+ repo = "vuln";
1010+ rev = "27dd78d2ca392c1738e54efe513a2ecb7bf46000";
1111+ sha256 = "sha256-G35y1V4W1nLZ+QGvIQwER9whBIBDFUVptrHx78orcI0=";
1212+ };
1313+1414+ vendorSha256 = "sha256-9FH9nq5cEyhMxrrvfQAOWZ4aThMsU0HwlI+0W0uVHZ4=";
1515+1616+ subPackages = [ "cmd/govulncheck" ];
1717+1818+ preCheck = ''
1919+ # test all paths
2020+ unset subPackages
2121+2222+ # remove test that calls checks.bash
2323+ # the header check and misspell gets upset at the vendor dir
2424+ rm all_test.go
2525+2626+ # remove tests that generally have "inconsistent vendoring" issues
2727+ # - tries to builds govulncheck again
2828+ rm cmd/govulncheck/main_command_118_test.go
2929+ # - does go builds of example go files
3030+ rm vulncheck/binary_test.go
3131+ # - just have resolution issues
3232+ rm vulncheck/{source,vulncheck}_test.go
3333+ '';
3434+3535+ ldflags = [ "-s" "-w" ];
3636+3737+ meta = with lib; {
3838+ homepage = "https://pkg.go.dev/golang.org/x/vuln/cmd/govulncheck";
3939+ description = "The database client and tools for the Go vulnerability database, also known as vuln";
4040+ longDescription = ''
4141+ Govulncheck reports known vulnerabilities that affect Go code. It uses
4242+ static analysis of source code or a binary's symbol table to narrow down
4343+ reports to only those that could affect the application.
4444+4545+ By default, govulncheck makes requests to the Go vulnerability database at
4646+ https://vuln.go.dev. Requests to the vulnerability database contain only
4747+ module paths, not code or other properties of your program. See
4848+ https://vuln.go.dev/privacy.html for more. Set the GOVULNDB environment
4949+ variable to specify a different database, which must implement the
5050+ specification at https://go.dev/security/vuln/database.
5151+5252+ Govulncheck looks for vulnerabilities in Go programs using a specific
5353+ build configuration. For analyzing source code, that configuration is the
5454+ operating system, architecture, and Go version specified by GOOS, GOARCH,
5555+ and the “go” command found on the PATH. For binaries, the build
5656+ configuration is the one used to build the binary. Note that different
5757+ build configurations may have different known vulnerabilities. For
5858+ example, a dependency with a Windows-specific vulnerability will not be
5959+ reported for a Linux build.
6060+ '';
6161+ license = with licenses; [ bsd3 ];
6262+ maintainers = with maintainers; [ jk ];
6363+ };
6464+}