make garble work on Go tip again

Just two minor tweaks were necessary to get "go test" to pass on:

	go version devel go1.17-a25c584629 Tue Apr 6 04:48:09 2021 +0000 linux/amd64

Re-enable the CI for it, too. The config needed changing since the
set-env and add-path commands now use special files instead, due to some
security issues uncovered last winter.

It's possible that CI on master could suddenly break, if Go master
changes in some substantial way that requires more tweaks. If that turns
out to be an issue pretty often, we could always pin a specific git repo
commit and update it every few weeks.
pull/307/head
Daniel Martí 3 years ago committed by Andrew LeFevre
parent 5d49955998
commit d38dfd4e90

@ -25,24 +25,23 @@ jobs:
go version
go test ./...
# TODO: re-enable once we get Go master/tip working again
#test-gotip:
# runs-on: ubuntu-latest
# continue-on-error: true # master breaks sometimes
# steps:
# - name: Install Go
# run: |
# git clone --depth=1 https://go.googlesource.com/go $HOME/gotip
# cd $HOME/gotip/src
# ./make.bash
# echo "::set-env name=GOROOT::$HOME/gotip"
# echo "::add-path::$HOME/gotip/bin"
# - name: Checkout code
# uses: actions/checkout@v2
# - name: Test
# run: |
# go version
# go test ./...
test-gotip:
runs-on: ubuntu-latest
continue-on-error: true # master breaks sometimes
steps:
- name: Install Go
run: |
git clone --depth=1 https://go.googlesource.com/go $HOME/gotip
cd $HOME/gotip/src
./make.bash
echo "GOROOT=$HOME/gotip" >>$GITHUB_ENV
echo "$HOME/gotip/bin" >>$GITHUB_PATH
- name: Checkout code
uses: actions/checkout@v2
- name: Test
run: |
go version
go test ./...
code-checks:
runs-on: ubuntu-latest

@ -817,6 +817,10 @@ var runtimeRelated = map[string]bool{
"unsafe": true,
"vendor/golang.org/x/net/dns/dnsmessage": true,
"vendor/golang.org/x/net/route": true,
// Manual additions for Go 1.17 as of April 2021.
"internal/abi": true,
"internal/itoa": true,
}
// isPrivate checks if a package import path should be considered private,

@ -64,10 +64,6 @@ func printFile(file1 *ast.File) ([]byte, error) {
toAdd = append(toAdd, commentToAdd{offset, text})
}
// Make sure the entire file gets a zero filename by default,
// in case we miss any positions below.
addComment(0, "/*line :1*/")
// Remove any comments by making them whitespace.
// Keep directives, as they affect the build.
// This is superior to removing the comments before printing,
@ -123,6 +119,13 @@ func printFile(file1 *ast.File) ([]byte, error) {
copied := 0
var buf2 bytes.Buffer
// Make sure the entire file gets a zero filename by default,
// in case we miss any positions below.
// We use a //-style comment, because there might be build tags.
// addComment is for /*-style comments, so add it to buf2 directly.
buf2.WriteString("//line :1\n")
for _, comment := range toAdd {
buf2.Write(src[copied:comment.offset])
copied = comment.offset

Loading…
Cancel
Save