zaquestion / lab

Lab wraps Git or Hub, making it simple to clone, fork, and interact with repositories on GitLab
https://zaquestion.github.io/lab
Creative Commons Zero v1.0 Universal
1.11k stars 102 forks source link

lab: update go.mod version #776

Closed tydavis closed 2 years ago

tydavis commented 2 years ago

Update go.mod version to take advantage of the latest module graph and lazy-loading mechanisms in 1.17+

https://go.dev/doc/modules/gomod-ref#go-notes

codecov[bot] commented 2 years ago

Codecov Report

Merging #776 (ed0880c) into master (e95cb81) will increase coverage by 0.07%. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #776      +/-   ##
==========================================
+ Coverage   55.05%   55.12%   +0.07%     
==========================================
  Files          77       77              
  Lines        5584     5584              
==========================================
+ Hits         3074     3078       +4     
+ Misses       2226     2223       -3     
+ Partials      284      283       -1     
Impacted Files Coverage Δ
cmd/fork.go 63.15% <0.00%> (+5.26%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e95cb81...ed0880c. Read the comment docs.

bmeneg commented 2 years ago

Could you also update the go version used in both .gitlab-ci.yml and .travis.yml files? So we can have the tests running against the same version. (yes, they were already mismatching 🤦 )

bmeneg commented 2 years ago

Oh, ok, Go 1.17 brought new build directives, finally. Even though I have to rework this specific syscalls (use a better package) could you add the new //go:build directives as pointed out by the gofmt test output? But leave the old // +build ones as is, so people running older Go versions can still build it.

diff -u cmd/root_nowindows_test.go.orig cmd/root_nowindows_test.go
+--- cmd/root_nowindows_test.go.orig    2022-01-06 18:11:49.896838864 +0000
++++ cmd/root_nowindows_test.go 2022-01-06 18:11:49.896838864 +0000
+@@ -1,3 +1,4 @@
++//go:build !windows
+ // +build !windows
+ 
+ package cmd
+diff -u cmd/root_windows_test.go.orig cmd/root_windows_test.go
+--- cmd/root_windows_test.go.orig  2022-01-06 18:11:49.896838864 +0000
++++ cmd/root_windows_test.go   2022-01-06 18:11:49.896838864 +0000
+@@ -1,3 +1,4 @@
++//go:build windows
+ // +build windows
+ 
+ package cmd
+diff -u cmd/util_bsd.go.orig cmd/util_bsd.go
+--- cmd/util_bsd.go.orig   2022-01-06 18:11:49.904842865 +0000
++++ cmd/util_bsd.go    2022-01-06 18:11:49.908844864 +0000
+@@ -1,5 +1,6 @@
+ // This file contains Darwin (MacOS) and *BSD specific calls.
+ 
++//go:build freebsd || openbsd || dragonfly || darwin
+ // +build freebsd openbsd dragonfly darwin
+ 
+ package cmd
The command "diff -u <(echo -n) <(gofmt -d .)" exited with 1.

Many thanks.

tydavis commented 2 years ago

@bmeneg Build directives are updated.

bmeneg commented 2 years ago

@tydavis, the util_darwin.go that you created isn't necessary. We kept darwin in the util_bsd.go build directive exactly because they're identical, avoiding one additional file. In this space, darwin is mostly a mimic of freebsd's kernel, and keeping the directive for other BSDs is also important: few months ago I was using OpenBSD at home and used lab eventually, I might not be the only one :smile:. DrangonflyBSD might be less used, but it doesn't hurt on keeping it there in the _bsd file.

tydavis commented 2 years ago

@bmeneg something went wrong with my autosave formatters. I've fixed it.