Browse Source

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.
Daniel Martí 11 months ago
parent
commit
4f0657a19a
4 changed files with 20 additions and 15 deletions
  1. 8 4
      .github/workflows/test.yml
  2. 2 1
      CHANGELOG.md
  3. 8 10
      internal/literals/obfuscators.go
  4. 2 0
      shared.go

+ 8 - 4
.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

+ 2 - 1
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
 

+ 8 - 10
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.

+ 2 - 0
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
 		}