golds: init at 0.7.1

Signed-off-by: phanirithvij <phanirithvij2000@gmail.com>
Co-authored-by: Kenichi Kamiya <kachick1@gmail.com>

+67
+25
pkgs/by-name/go/golds/info_module-gover.patch
··· 1 + diff --git a/internal/server/info_module.go b/internal/server/info_module.go 2 + index d2513bd..ad2921e 100644 3 + --- a/internal/server/info_module.go 4 + +++ b/internal/server/info_module.go 5 + @@ -8,6 +8,7 @@ import ( 6 + "io/ioutil" 7 + "log" 8 + "os" 9 + + "os/exec" 10 + "path/filepath" 11 + "regexp" 12 + "strings" 13 + @@ -756,7 +757,11 @@ func findGoToolchainVersionFromGoRoot(goroot string) (string, error) { 14 + versionData, err = ioutil.ReadFile(filepath.Join(goroot, "VERSION.cache")) 15 + } 16 + if err != nil { 17 + - return "", fmt.Errorf("failed to get Go toolchain version in GOROOT (%s)", goroot) 18 + + cmd := exec.Command("go", "env", "GOVERSION") 19 + + versionData, err = cmd.Output() 20 + + if err != nil { 21 + + return "", fmt.Errorf("failed to get Go toolchain version in GOROOT (%s)", goroot) 22 + + } 23 + } 24 + matches := findGoVersionRegexp.FindSubmatch(versionData) 25 + if len(matches) >= 1 {
+42
pkgs/by-name/go/golds/package.nix
··· 1 + { 2 + lib, 3 + buildGoModule, 4 + fetchFromGitHub, 5 + testers, 6 + golds, # self 7 + }: 8 + 9 + buildGoModule rec { 10 + pname = "golds"; 11 + version = "0.7.1"; 12 + 13 + src = fetchFromGitHub { 14 + owner = "go101"; 15 + repo = "golds"; 16 + tag = "v${version}"; 17 + hash = "sha256-6YkyKJtSAFFYidMlZXSjNpjyIIaTlibg/QMMin/NbU0="; 18 + }; 19 + 20 + # nixpkgs is not using the go distpack archive and missing a VERSION file in the source 21 + # but we can use go env to get the same information 22 + # https://github.com/NixOS/nixpkgs/pull/358316#discussion_r1855322027 23 + patches = [ ./info_module-gover.patch ]; 24 + 25 + vendorHash = "sha256-omjHRZB/4VzPhc6RrFY11s6BRD69+Y4RRZ2XdeKbZf0="; 26 + 27 + ldflags = [ "-s" ]; 28 + 29 + passthru.tests.version = testers.testVersion { 30 + package = golds; 31 + version = "v${version}"; 32 + }; 33 + 34 + meta = { 35 + description = "Experimental Go local docs server/generator and code reader implemented with some fresh ideas"; 36 + homepage = "https://github.com/go101/golds"; 37 + license = lib.licenses.mit; 38 + platforms = lib.platforms.unix; 39 + maintainers = with lib.maintainers; [ phanirithvij ]; 40 + mainProgram = "golds"; 41 + }; 42 + }