File tree 5 files changed +33
-9
lines changed 5 files changed +33
-9
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env sh
2
+ #
3
+ # This is a temporary hack to work around
4
+ # https://github.com/golang/go/issues/51629 , wherein the stringer
5
+ # generator doesn't work with generics.
6
+ #
7
+ # This script is the equivalent of `go generate ./...`, except that it
8
+ # only runs generate on packages that don't try to use stringer.
9
+
10
+ find . -name ' *.go' | xargs grep -l go:generate | xargs -n1 dirname | sort -u | while read dir; do
11
+ if ! grep cmd/stringer $dir /* .go; then
12
+ set -x
13
+ go generate -tags=hermetic $dir
14
+ set +x
15
+ fi
16
+ done
Original file line number Diff line number Diff line change @@ -25,14 +25,13 @@ jobs:
25
25
fetch-depth : 0
26
26
27
27
- name : check 'go generate' is clean
28
+ # The shell script invocation below is a temporary hack for
29
+ # https://github.com/tailscale/tailscale/issues/4194. When
30
+ # that issue is fixed, replace its invocation with:
31
+ # go generate --tags=hermetic ./...
28
32
run : |
29
- if [[ "${{github.ref}}" == release-branch/* ]]
30
- then
31
- pkgs=$(go list ./... | grep -v dnsfallback)
32
- else
33
- pkgs=$(go list ./... | grep -v dnsfallback)
34
- fi
35
- go generate $pkgs
33
+ set -e
34
+ ./.github/workflows/go-generate-without-stringer.sh
36
35
echo
37
36
echo
38
37
git diff --name-only --exit-code || (echo "The files above need updating. Please run 'go generate'."; exit 1)
Original file line number Diff line number Diff line change 2
2
// Use of this source code is governed by a BSD-style
3
3
// license that can be found in the LICENSE file.
4
4
5
- //go:generate go run update-dns-fallbacks.go
6
-
7
5
// Package dnsfallback contains a DNS fallback mechanism
8
6
// for starting up Tailscale when the system DNS is broken or otherwise unavailable.
9
7
package dnsfallback
Original file line number Diff line number Diff line change
1
+ // Copyright (c) 2022 Tailscale Inc & AUTHORS All rights reserved.
2
+ // Use of this source code is governed by a BSD-style
3
+ // license that can be found in the LICENSE file.
4
+
5
+ //go:build !hermetic
6
+ // +build !hermetic
7
+
8
+ package dnsfallback
9
+
10
+ //go:generate go run update-dns-fallbacks.go
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import (
19
19
)
20
20
21
21
func main () {
22
+ log .Printf ("RUN RUN RUN" )
22
23
res , err := http .Get ("https://login.tailscale.com/derpmap/default" )
23
24
if err != nil {
24
25
log .Fatal (err )
You can’t perform that action at this time.
0 commit comments