Skip to content

Commit abdddeb

Browse files
Update to go 1.19 (#644)
* Update to go 1.19 Derp realized I need this for my fuzzing PR, since fuzzing is only supported as of 1.18 * chore: remove vert fork * chore: prefer vert fork * chore: add vert to go.sum * chore: go mod tidy * chore: add vscode settings * chore: cleanup entrypoint * fix: unwrap vert.ValueOf before returning * chore: update lint settings * chore: replace interface{} with any * chore: add changeset * Delete nasty-ligers-kiss.md Co-authored-by: Nate Moore <[email protected]> Co-authored-by: Nate Moore <[email protected]>
1 parent f95ced5 commit abdddeb

File tree

10 files changed

+36
-49
lines changed

10 files changed

+36
-49
lines changed

.changeset/calm-cobras-tie.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@astrojs/compiler': patch
3+
---
4+
5+
Update Go to 1.19

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// Update the VARIANT arg to pick a version of Go: 1, 1.16, 1.17
99
// Append -bullseye or -buster to pin to an OS version.
1010
// Use -bullseye variants on local arm64/Apple Silicon.
11-
"VARIANT": "1.17",
11+
"VARIANT": "1.19",
1212
// Options
1313
"NODE_VERSION": "16"
1414
}

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Set up Go
2121
uses: actions/setup-go@v2
2222
with:
23-
go-version: 1.17
23+
go-version: 1.19
2424

2525
- name: Test
2626
run: go test -v ./internal/...
@@ -36,7 +36,7 @@ jobs:
3636
- name: Set up Go
3737
uses: actions/setup-go@v2
3838
with:
39-
go-version: 1.17
39+
go-version: 1.19
4040

4141
- name: Set up PNPM
4242
uses: pnpm/[email protected]

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Set up Go
1717
uses: actions/setup-go@v2
1818
with:
19-
go-version: 1.17
19+
go-version: 1.19
2020

2121
- name: Set up PNPM
2222
uses: pnpm/[email protected]

.golangci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ issues:
1515

1616
- linters:
1717
- typecheck
18-
text: 'syscall/js'
18+
text: "syscall/js"
1919
- linters:
2020
- staticcheck
21-
text: 'SA9003'
21+
text: "SA9003"
2222
- linters:
2323
- typecheck
24-
text: 'github.com/norunners/vert'
24+
text: "by package vert"

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"go.toolsEnvVars": {
3+
"GOOS": "js",
4+
"GOARCH": "wasm"
5+
}
6+
}

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Contributions are welcome to the Go compiler!
66

77
### Go
88

9-
[Go][go] `1.17.x` is needed to work with this repo. On Macs, installing via [Homebrew][homebrew] is recommended: `brew install go`. For Windows & Linux, you can [follow Go’s installation guide][go] if you don’t have your own preferred method of package installation.
9+
[Go][go] `1.19.x` is needed to work with this repo. On Macs, installing via [Homebrew][homebrew] is recommended: `brew install go`. For Windows & Linux, you can [follow Go’s installation guide][go] if you don’t have your own preferred method of package installation.
1010

1111
If you use VS Code as your primary editor, installing the [Go extension][go-vscode] is highly recommended.
1212

cmd/astro-wasm/astro-wasm.go

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//go:build js && wasm
2-
// +build js,wasm
3-
41
package main
52

63
import (
@@ -23,8 +20,6 @@ import (
2320
wasm_utils "github.com/withastro/compiler/internal_wasm/utils"
2421
)
2522

26-
var done chan bool
27-
2823
func main() {
2924
js.Global().Set("@astrojs/compiler", js.ValueOf(make(map[string]interface{})))
3025
module := js.Global().Get("@astrojs/compiler")
@@ -114,7 +109,7 @@ func makeTransformOptions(options js.Value) transform.TransformOptions {
114109
staticExtraction = true
115110
}
116111

117-
var resolvePath interface{} = options.Get("resolvePath")
112+
var resolvePath any = options.Get("resolvePath")
118113
var resolvePathFn func(string) string
119114
if resolvePath.(js.Value).Type() == js.TypeFunction {
120115
resolvePathFn = func(id string) string {
@@ -216,8 +211,8 @@ func preprocessStyle(i int, style *astro.Node, transformOptions transform.Transf
216211
style.FirstChild.Data = str
217212
}
218213

219-
func Parse() interface{} {
220-
return js.FuncOf(func(this js.Value, args []js.Value) interface{} {
214+
func Parse() any {
215+
return js.FuncOf(func(this js.Value, args []js.Value) any {
221216
source := jsString(args[0])
222217
parseOptions := makeParseOptions(js.Value(args[1]))
223218
transformOptions := makeTransformOptions(js.Value(args[1]))
@@ -237,12 +232,12 @@ func Parse() interface{} {
237232
return vert.ValueOf(ParseResult{
238233
AST: string(result.Output),
239234
Diagnostics: h.Diagnostics(),
240-
})
235+
}).Value
241236
})
242237
}
243238

244-
func ConvertToTSX() interface{} {
245-
return js.FuncOf(func(this js.Value, args []js.Value) interface{} {
239+
func ConvertToTSX() any {
240+
return js.FuncOf(func(this js.Value, args []js.Value) any {
246241
source := jsString(args[0])
247242
transformOptions := makeTransformOptions(js.Value(args[1]))
248243
transformOptions.Scope = "XXXXXX"
@@ -269,20 +264,20 @@ func ConvertToTSX() interface{} {
269264
Code: code,
270265
Map: sourcemapString,
271266
Diagnostics: h.Diagnostics(),
272-
})
267+
}).Value
273268
})
274269
}
275270

276-
func Transform() interface{} {
277-
return js.FuncOf(func(this js.Value, args []js.Value) interface{} {
271+
func Transform() any {
272+
return js.FuncOf(func(this js.Value, args []js.Value) any {
278273
source := jsString(args[0])
279274

280275
transformOptions := makeTransformOptions(js.Value(args[1]))
281276
transformOptions.Scope = astro.HashFromSourceAndModuleId(source, transformOptions.ModuleId)
282277
h := handler.NewHandler(source, transformOptions.Filename)
283278

284279
styleError := []string{}
285-
handler := js.FuncOf(func(this js.Value, args []js.Value) interface{} {
280+
handler := js.FuncOf(func(this js.Value, args []js.Value) any {
286281
resolve := args[0]
287282

288283
go func() {
@@ -426,8 +421,8 @@ func Transform() interface{} {
426421
StyleError: styleError,
427422
})
428423
}
429-
value.Set("diagnostics", vert.ValueOf(h.Diagnostics()))
430-
resolve.Invoke(value)
424+
value.Set("diagnostics", vert.ValueOf(h.Diagnostics()).Value)
425+
resolve.Invoke(value.Value)
431426
}()
432427

433428
return nil

go.mod

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
module github.com/withastro/compiler
22

3-
go 1.17
3+
go 1.19
44

55
require (
66
github.com/google/go-cmp v0.5.9
77
github.com/iancoleman/strcase v0.2.0
88
github.com/lithammer/dedent v1.1.0
9-
github.com/norunners/vert v0.0.0-20211229045251-b4c39e2856da
9+
github.com/norunners/vert v0.0.0-20221203075838-106a353d42dd
1010
github.com/tdewolff/parse/v2 v2.6.4
1111
golang.org/x/net v0.0.0-20221004154528-8021a29435af
1212
golang.org/x/sys v0.0.0-20221010170243-090e33056c14
1313
)
14-
15-
replace github.com/norunners/vert => github.com/natemoo-re/vert v0.0.0-natemoo-re.8

go.sum

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,16 @@
1-
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
2-
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
31
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
42
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
53
github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0=
64
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
75
github.com/lithammer/dedent v1.1.0 h1:VNzHMVCBNG1j0fh3OrsFRkVUwStdDArbgBWoPAffktY=
86
github.com/lithammer/dedent v1.1.0/go.mod h1:jrXYCQtgg0nJiN+StA2KgR7w6CiQNv9Fd/Z9BP0jIOc=
9-
github.com/natemoo-re/vert v0.0.0-natemoo-re.8 h1:RCxCOL0e2bvB0wrmF/77X8/uewz/K7iU4TjVqpZm/T4=
10-
github.com/natemoo-re/vert v0.0.0-natemoo-re.8/go.mod h1:67MuD9cDWe6pmhyQrElFlSNMMzL0CMUdFURKxJSvxUM=
11-
github.com/tdewolff/parse/v2 v2.5.22 h1:KXMHTyx4VTL6Zu9a94SULQalDMvtP5FQq10mnSfaoGs=
12-
github.com/tdewolff/parse/v2 v2.5.22/go.mod h1:WzaJpRSbwq++EIQHYIRTpbYKNA3gn9it1Ik++q4zyho=
13-
github.com/tdewolff/parse/v2 v2.5.27 h1:PL3LzzXaOpmdrknnOlIeO2muIBHAwiKp6TxN1RbU5gI=
14-
github.com/tdewolff/parse/v2 v2.5.27/go.mod h1:WzaJpRSbwq++EIQHYIRTpbYKNA3gn9it1Ik++q4zyho=
7+
github.com/norunners/vert v0.0.0-20221203075838-106a353d42dd h1:tHn7K76q9eJ2rXLH/OoxHkdprM3l2A+0kdxOrKYcV7U=
8+
github.com/norunners/vert v0.0.0-20221203075838-106a353d42dd/go.mod h1:8iuQLyTSvuzwy6R6l6w6J+i9c/6xPEVoVdcMz9E8FEw=
159
github.com/tdewolff/parse/v2 v2.6.4 h1:KCkDvNUMof10e3QExio9OPZJT8SbdKojLBumw8YZycQ=
1610
github.com/tdewolff/parse/v2 v2.6.4/go.mod h1:woz0cgbLwFdtbjJu8PIKxhW05KplTFQkOdX78o+Jgrs=
17-
github.com/tdewolff/test v1.0.6 h1:76mzYJQ83Op284kMT+63iCNCI7NEERsIN8dLM+RiKr4=
18-
github.com/tdewolff/test v1.0.6/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE=
11+
github.com/tdewolff/test v1.0.7 h1:8Vs0142DmPFW/bQeHRP3MV19m1gvndjUb1sn8yy74LM=
1912
github.com/tdewolff/test v1.0.7/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE=
20-
golang.org/x/net v0.0.0-20210716203947-853a461950ff h1:j2EK/QoxYNBsXI4R7fQkkRUk8y6wnOBI+6hgPdP/6Ds=
21-
golang.org/x/net v0.0.0-20210716203947-853a461950ff/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
2213
golang.org/x/net v0.0.0-20221004154528-8021a29435af h1:wv66FM3rLZGPdxpYL+ApnDe2HzHcTFta3z5nsc13wI4=
2314
golang.org/x/net v0.0.0-20221004154528-8021a29435af/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
24-
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
25-
golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c=
26-
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
2715
golang.org/x/sys v0.0.0-20221010170243-090e33056c14 h1:k5II8e6QD8mITdi+okbbmR/cIyEbeXLBhy5Ha4nevyc=
2816
golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
29-
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
30-
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
31-
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
32-
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
33-
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

0 commit comments

Comments
 (0)