You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GopherJS gained support for building code in module mode in 2021
(see PR gopherjs#1042), and it itself didn't have problems being built
in module mode since much earlier.
Recently, it started getting semver tags that are recognized in
module mode like `v1.17.2` and `v1.18.0-beta1` (see issue gopherjs#847).
Start suggesting the `go install` command to install its latest
release in the README.
(It remains possible to get the latest development version with
something like `go install github.com/gopherjs/gopherjs@HEAD`,
or one of the pre-release versions from `go list -m -versions`
such as `go install github.com/gopherjs/[email protected]`.)
While here, also update to the new shorter Go website domain and
latest Go 1.18 point release.
GopherJS compiles Go code ([golang.org](https://golang.org/)) to pure JavaScript code. Its main purpose is to give you the opportunity to write front-end code in Go which will still run in all browsers.
8
+
GopherJS compiles Go code ([go.dev](https://go.dev/)) to pure JavaScript code. Its main purpose is to give you the opportunity to write front-end code in Go which will still run in all browsers.
9
9
10
10
### Help us make GopherJS better!
11
11
@@ -33,20 +33,20 @@ Nearly everything, including Goroutines ([compatibility documentation](https://g
33
33
### Installation and Usage
34
34
35
35
GopherJS [requires Go 1.18 or newer](https://github.com/gopherjs/gopherjs/blob/master/doc/compatibility.md#go-version-compatibility). If you need an older Go
36
-
version, you can use an [older Gopher release](https://github.com/gopherjs/gopherjs/releases).
36
+
version, you can use an [older GopherJS release](https://github.com/gopherjs/gopherjs/releases).
37
37
38
-
Get or update GopherJS and dependencies with:
38
+
Install GopherJS with `go install`:
39
39
40
40
```
41
-
go get -u github.com/gopherjs/gopherjs
41
+
go install github.com/gopherjs/gopherjs@latest # Or replace 'latest' with another version.
42
42
```
43
43
44
44
If your local Go distribution as reported by `go version` is newer than Go 1.18, then you need to set the `GOPHERJS_GOROOT` environment variable to a directory that contains a Go 1.18 distribution. For example:
45
45
46
46
```
47
-
go get golang.org/dl/go1.18.1
48
-
go1.18.1 download
49
-
export GOPHERJS_GOROOT="$(go1.18.1 env GOROOT)" # Also add this line to your .profile or equivalent.
47
+
go install golang.org/dl/go1.18.6@latest
48
+
go1.18.6 download
49
+
export GOPHERJS_GOROOT="$(go1.18.6 env GOROOT)" # Also add this line to your .profile or equivalent.
50
50
```
51
51
52
52
Now you can use `gopherjs build [package]`, `gopherjs build [files]` or `gopherjs install [package]` which behave similar to the `go` tool. For `main` packages, these commands create a `.js` file and `.js.map` source map in the current directory or in `$GOPATH/bin`. The generated JavaScript file can be used as usual in a website. Use `gopherjs help [command]` to get a list of possible command line flags, e.g. for minification and automatically watching for changes.
0 commit comments