Movatterモバイル変換


[0]ホーム

URL:


Wayback Machine
213 captures
07 Oct 2014 - 14 Sep 2025
OctDECJan
Previous capture12Next capture
202220232024
success
fail
COLLECTED BY
Organization:Archive Team
Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

History is littered with hundreds of conflicts over the future of a community, group, location or business that were "resolved" when one of the parties stepped ahead and destroyed what was there. With the original point of contention destroyed, the debates would fall to the wayside. Archive Team believes that by duplicated condemned data, the conversation and debate can continue, as well as the richness and insight gained by keeping the materials. Our projects have ranged in size from a single volunteer downloading the data to a small-but-critical site, to over 100 volunteers stepping forward to acquire terabytes of user-created data to save for future generations.

The main site for Archive Team is atarchiveteam.org and contains up to the date information on various projects, manifestos, plans and walkthroughs.

This collection contains the output of many Archive Team projects, both ongoing and completed. Thanks to the generous providing of disk space by the Internet Archive, multi-terabyte datasets can be made available, as well as in use by theWayback Machine, providing a path back to lost websites and work.

Our collection has grown to the point of having sub-collections for the type of data we acquire. If you are seeking to browse the contents of these collections, the Wayback Machine is the best first stop. Otherwise, you are free to dig into the stacks to see what you may find.

The Archive Team Panic Downloads are full pulldowns of currently extant websites, meant to serve as emergency backups for needed sites that are in danger of closing, or which will be missed dearly if suddenly lost due to hard drive crashes or server failures.

ArchiveBot is an IRC bot designed to automate the archival of smaller websites (e.g. up to a few hundred thousand URLs). You give it a URL to start at, and it grabs all content under that URL, records it in a WARC, and then uploads that WARC to ArchiveTeam servers for eventual injection into the Internet Archive (or other archive sites).

To use ArchiveBot, drop by #archivebot on EFNet. To interact with ArchiveBot, you issue commands by typing it into the channel. Note you will need channel operator permissions in order to issue archiving jobs. The dashboard shows the sites being downloaded currently.

There is a dashboard running for the archivebot process athttp://www.archivebot.com.

ArchiveBot's source code can be found athttps://github.com/ArchiveTeam/ArchiveBot.

TIMESTAMPS
loading
The Wayback Machine - https://web.archive.org/web/20231212143621/https://github.com/gopherjs/gopherjs
Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A compiler from Go to JavaScript for running Go code in a browser

License

gopherjs/gopherjs

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
September 1, 2023 20:53
October 16, 2013 13:43
November 8, 2013 13:56

GopherJS - A compiler from Go to JavaScript

GoDocSourcegraphCircle CI

GopherJS compiles Go code (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.

Help us make GopherJS better!

What's new?

  • 2022-08-18: Go 1.18 support isavailable!
  • 2021-09-19: Go 1.17 support is available!
  • 2021-08-23: Go Modules are now fully supported.
  • 2021-06-19: Completesyscall/js package implementation compatible with the upstream Go 1.16.
  • 2021-04-04:Go 1.16 is now officially supported! 🎉 🎉 🎉

Playground

Give GopherJS a try on theGopherJS Playground.

What is supported?

Nearly everything, including Goroutines (compatibility documentation). Performance is quite good in most cases, seeHTML5 game engine benchmark. Cgo is not supported.

Installation and Usage

GopherJSrequires Go 1.18 or newer. If you need an older Goversion, you can use anolder GopherJS release.

Install GopherJS withgo install:

go install github.com/gopherjs/gopherjs@v1.18.0-beta3  # Or replace 'v1.18.0-beta3' with another version.

If your local Go distribution as reported bygo version is newer than Go 1.18, then you need to set theGOPHERJS_GOROOT environment variable to a directory that contains a Go 1.18 distribution. For example:

go install golang.org/dl/go1.18.10@latestgo1.18.10 downloadexport GOPHERJS_GOROOT="$(go1.18.10 env GOROOT)"  # Also add this line to your .profile or equivalent.

Now you can usegopherjs build [package],gopherjs build [files] orgopherjs install [package] which behave similar to thego tool. Formain 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. Usegopherjs help [command] to get a list of possible command line flags, e.g. for minification and automatically watching for changes.

gopherjs uses your platform's defaultGOOS value when generating code. SupportedGOOS values are:linux,darwin. If you're on a different platform (e.g., Windows or FreeBSD), you'll need to set theGOOS environment variable to a supported value. For example,GOOS=linux gopherjs build [package].

Note: GopherJS will try to write compiled object files of the core packages to your $GOROOT/pkg directory. If that fails, it will fall back to $GOPATH/pkg.

gopherjs run, gopherjs test

If you want to usegopherjs run orgopherjs test to run the generated code locally, install Node.js 10.0.0 (or newer), and thesource-map-support module:

npm install --global source-map-support

On supportedGOOS platforms, it's possible to make system calls (file system access, etc.) available. Seedoc/syscalls.md for instructions on how to do so.

gopherjs serve

gopherjs serve is a useful command you can use during development. It will start an HTTP server serving on ":8080" by default, then dynamically compile your Go packages with GopherJS and serve them.

For example, navigating tohttp://localhost:8080/example.com/user/project/ should compile and run the Go packageexample.com/user/project. The generated JavaScript output will be served athttp://localhost:8080/example.com/user/project/project.js (the .js file name will be equal to the base directory name). If the directory containsindex.html it will be served, otherwise a minimalindex.html that includes<script src="project.js"></script> will be provided, causing the JavaScript to be executed. All other static files will be served too.

Refreshing in the browser will rebuild the served files if needed. Compilation errors will be displayed in terminal, and in browser console. Additionally, it will serve $GOROOT and $GOPATH for sourcemaps.

If you include an argument, it will be the root from which everything is served. For example, if you rungopherjs serve github.com/user/project then the generated JavaScript for the package github.com/user/project/mypkg will be served athttp://localhost:8080/mypkg/mypkg.js.

Environment Variables

There are some GopherJS-specific environment variables:

  • GOPHERJS_GOROOT - if set, GopherJS uses this value as the default GOROOTvalue, instead of using the system GOROOT as the default GOROOT value
  • GOPHERJS_SKIP_VERSION_CHECK - if set to true, GopherJS will not checkGo version in the GOROOT for compatibility with the GopherJS release. Thisis primarily useful for testing GopherJS against unreleased versions of Go.

Performance Tips

Community

Getting started

Interacting with the DOM

The packagegithub.com/gopherjs/gopherjs/js (seedocumentation) provides functions for interacting with native JavaScript APIs. For example the line

document.write("Hello world!");

would look like this in Go:

js.Global.Get("document").Call("write","Hello world!")

You may also want use theDOM bindings, thejQuery bindings (seeTodoMVC Example) or theAngularJS bindings. Those are some of thebindings to JavaScript APIs and libraries by community members.

Providing library functions for use in other JavaScript code

Set a global variable to a map that contains the functions:

package mainimport"github.com/gopherjs/gopherjs/js"funcmain() {js.Global.Set("pet",map[string]interface{}{"New":New,})}typePetstruct {namestring}funcNew(namestring)*js.Object {returnjs.MakeWrapper(&Pet{name})}func (p*Pet)Name()string {returnp.name}func (p*Pet)SetName(namestring) {p.name=name}

For more details seeJason Stone's blog post about GopherJS.

Architecture

General

GopherJS emulates a 32-bit environment. This means thatint,uint anduintptr have a precision of 32 bits. However, the explicit 64-bit integer typesint64 anduint64 are supported.

TheGOOS value of this environment isjs, and theGOARCH value isecmascript. You may use these values in build constraints whenwriting platform-specific code. (GopherJS 1.17 and older usedjs as theGOARCH value.)

Application Lifecycle

Themain function is executed as usual after allinit functions have run. JavaScript callbacks can also invoke Go functions, even after themain function has exited. Therefore the end of themain function should not be regarded as the end of the application and does not end the execution of other goroutines.

In the browser, callingos.Exit (e.g. indirectly bylog.Fatal) also does not terminate the execution of the program. For convenience, it callsruntime.Goexit to immediately terminate the calling goroutine.

Goroutines

Goroutines are fully supported by GopherJS. The only restriction is that you need to start a new goroutine if you want to use blocking code called from external #"auto" data-snippet-clipboard-copy-content="js.Global.Get("myButton").Call("addEventListener", "click", func() { go func() { [...] someBlockingFunction() [...] }()})">

js.Global.Get("myButton").Call("addEventListener","click",func() {gofunc() {    [...]someBlockingFunction()    [...]  }()})

How it works:

JavaScript has no concept of concurrency (except web workers, but those are too strictly separated to be used for goroutines). Because of that, instructions in JavaScript are never blocking. A blocking call would effectively freeze the responsiveness of your web page, so calls with callback arguments are used instead.

GopherJS does some heavy lifting to work around this restriction: Whenever an instruction is blocking (e.g. communicating with a channel that isn't ready), the whole stack will unwind (= all functions return) and the goroutine will be put to sleep. Then another goroutine which is ready to resume gets picked and its stack with all local variables will be restored.

GopherJS Development

If you're looking to make changes to the GopherJS compiler, seeDeveloper Guidelines for additional developer information.


[8]ページ先頭

©2009-2025 Movatter.jp