Skip to content

Commit 973aad1

Browse files
committed
internal/wasmserveutil: fix comments
1 parent 36b5e51 commit 973aad1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

internal/wasmserveutil/util.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,24 @@ import (
1111

1212
var reGoVersion = regexp.MustCompile(`^go(\d+)\.(\d+)(\.(\d+))?`)
1313

14+
// WasmExecJSURL returns the URL of wasm_exec.js for the given Go version like 'go1.23.4'.
1415
func WasmExecJSURL(goVersion string) (string, error) {
15-
// go.mod might have a version without `.0` like `go1.22`. This version might not work as a part of URL.
1616
m := reGoVersion.FindStringSubmatch(goVersion)
1717
if len(m) == 0 {
1818
return "", fmt.Errorf("wasmserve: invalid Go version: %s", goVersion)
1919
}
2020
minor, _ := strconv.Atoi(m[2])
21+
22+
// go.mod might have a version without `.0` like `go1.22`. This version might not work as a part of URL.
2123
if minor >= 22 && m[3] == "" {
2224
goVersion += ".0"
2325
}
26+
27+
// The directory name was changed from `misc` to `lib` at Go 1.23.
2428
dir := "lib"
2529
if minor <= 23 {
2630
dir = "misc"
2731
}
32+
2833
return fmt.Sprintf("https://go.googlesource.com/go/+/refs/tags/%s/%s/wasm/wasm_exec.js?format=TEXT", goVersion, dir), nil
2934
}

0 commit comments

Comments
 (0)