From 4f0657a19abc3c4f42ddeaa7b09d7233b958e766 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Thu, 6 Jan 2022 15:33:26 +0000 Subject: [PATCH] prepare for v0.5.0 While here, add a TODO I forgot about, and run gofumpt. Also bump all test timeouts slightly, as the Mac and Windows hosted runners are a bit slow and I've hit failures twice recently. --- .github/workflows/test.yml | 12 ++++++++---- CHANGELOG.md | 3 ++- internal/literals/obfuscators.go | 18 ++++++++---------- shared.go | 2 ++ 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6bc5577..c7e519f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,6 +5,11 @@ on: pull_request: branches: - master + +# Note that a full "go test" is quite heavy, +# as it runs many builds under the hood. +# The default -timeout=10m can be hit by the hosted runners. + name: Test jobs: test: @@ -23,11 +28,10 @@ jobs: - name: Test run: | go env - go test ./... + go test -timeout=15m ./... - name: Test with -race # macos and windows tend to be a bit slower, # and it's rare that a race in garble would be OS-specific. - # also note that this can take 5-10m, so use a larger timeout. if: matrix.os == 'ubuntu-latest' run: | go test -race -timeout=20m ./... @@ -50,7 +54,7 @@ jobs: - name: Test run: | go env - go test ./... + go test -timeout=15m ./... test-gotip: runs-on: ubuntu-latest @@ -77,7 +81,7 @@ jobs: - name: Test run: | go env - go test ./... + go test -timeout=15m ./... code-checks: runs-on: ubuntu-latest diff --git a/CHANGELOG.md b/CHANGELOG.md index 0627bbb..b8d62df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## WIP: [0.5.0] - 2021-12-?? +## [0.5.0] - 2022-01-06 This release of Garble adds initial support for the upcoming Go 1.18, continues support for Go 1.17.x, and drops support for Go 1.16.x. @@ -19,6 +19,7 @@ Noteworthy changes include: * Add the `-debug` flag to log details of the obfuscated build * Ensure the `runtime` package is built in a reproducible way * Obfuscate local variable names to prevent shadowing bugs +* Fix and test support for using garble on 32-bit hosts ## [0.4.0] - 2021-08-26 diff --git a/internal/literals/obfuscators.go b/internal/literals/obfuscators.go index f94b42e..62c57c3 100644 --- a/internal/literals/obfuscators.go +++ b/internal/literals/obfuscators.go @@ -15,16 +15,14 @@ type obfuscator interface { obfuscate(data []byte) *ast.BlockStmt } -var ( - // obfuscators contains all types which implement the obfuscator Interface - obfuscators = []obfuscator{ - simple{}, - swap{}, - split{}, - shuffle{}, - seed{}, - } -) +// obfuscators contains all types which implement the obfuscator Interface +var obfuscators = []obfuscator{ + simple{}, + swap{}, + split{}, + shuffle{}, + seed{}, +} // If math/rand.Seed() is not called, the generator behaves as if seeded by rand.Seed(1), // so the generator is deterministic. diff --git a/shared.go b/shared.go index 2060995..9c1bb41 100644 --- a/shared.go +++ b/shared.go @@ -248,6 +248,8 @@ func listPackage(path string) (*listedPackage, error) { if ok { return pkg, nil } + // TODO: List fewer packages here. std is 200+ packages, + // but in reality we should only miss 20-30 packages at most. if err := appendListedPackages("std"); err != nil { panic(err) // should never happen }