this sample code generate dynamic website like React.js
GopherJS requires Go 1.18 or newer. If you need an older Go version, you can use an older GopherJS release.
Install GopherJS with go install
:
go install github.com/gopherjs/[email protected] # Or replace 'v1.18.0-beta1' with another version.
Transpile golang to js with the following
gopherjs build [module|file]
Server with gopherjs
gopherjs serve
this command run local server on port 8080
for this sample code you must run the following command
gopherjs build main.go
gopherjs server
then open your browser and type following address
localhost:8080/index.html