基盤:まずシステム要件「the releases currently use the 10.15 SDK.」なのでOKです。
MacMini% ls xcode-select -p/Platforms/MacOSX.platform/Developer/SDKs DriverKit19.0.sdk MacOSX.sdk MacOSX10.15.sdk
開発:わたしは「macOS」とか「Mac OS X」という表記がしっくりこないのですが「MacOSX」という文字列をみるとホッとしますね。
基盤:では depot_tools というのをダウンロードしましょう。
MacMini% time git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git Cloning into 'depot_tools'… remote: Sending approximately 31.77 MiB … remote: Counting objects: 5, done remote: Finding sources: 100% (5/5) remote: Total 38977 (delta 26902), reused 38976 (delta 26902) Receiving objects: 100% (38977/38977), 31.77 MiB | 28.36 MiB/s, done. Resolving deltas: 100% (26902/26902), done. git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git 1.71s user 0.56s system 84% cpu 2.676 total
基盤:3秒で終了です。30MiB/sでダウンロードできてます。
社長:ついでに Machromium.blue というのも取ってみました。
基盤:では、本体のダウンロード開始します。
MacMini% time fetch --no-history chromium
開発:500Mbps出てますね。
基盤:「Expect the command to take 30 minutes on even a fast connection, and many hours on slower ones.」だそうですが、うちは 30分で行けそう。ギガビットのインターネットにして本当に良かったです。あ、終了しました。
fetch --no-history chromium 836.31s user 312.39s system 136% cpu 14:01.15 total
MacMini% pwd /Users/ysato/Desktop/MyChromium/mychromium/src MacMini% time gn gen out/Default Done. Made 13801 targets from 2310 files in 9057ms gn gen out/Default 13.57s user 4.53s system 188% cpu 9.621 total
基盤:あと、ccache というのを入れるとコンパイルが高速になるよとありますね。「 It speeds up recompilation of C/C++ code by caching previous compilations and detecting when the same compilation is being done again. 」。同じコンパイルって普通Makefileで日付見てスキップされると思うけど、そういう事ではないみたいですね。インストールしておきましょうか。昨日 brew というのも入れましたし。あれ、でも、brew の結果どこにインストールされたやら。よくわかんないのでこれはパスします。
Go 1.11 also adds an experimental port to WebAssembly (js/wasm). This allows programmers to compile Go programs to a binary format compatible with four major web browsers. You can read more about WebAssembly (abbreviated “Wasm”) at webassembly.org and see this wiki page on how to get started with using Wasm with Go.
基盤;「four major web browser」って、Safari が仲間外れなんでしょうかね(笑)
Go 1.11 adds an experimental port to WebAssembly (js/wasm).
Go programs currently compile to one WebAssembly module that includes the Go runtime for goroutine scheduling, garbage collection, maps, etc. As a result, the resulting size is at minimum around 2 MB, or 500 KB compressed. Go programs can call into JavaScript using the new experimental syscall/js package. Binary size and interop with other languages has not yet been a priority but may be addressed in future releases.
As a result of the addition of the new GOOS value "js" and GOARCH value "wasm", Go files named *_js.go or *_wasm.go will now be ignored by Go tools except when those GOOS/GOARCH values are being used. If you have existing filenames matching those patterns, you will need to rename them.
MacMini% ls -l total 4432 -rw-r--r-- 1 ysato staff 78 Jun 24 09:04 hello.go -rwxr-xr-x 1 ysato staff 2262220 Jun 24 09:17 main.wasm
基盤:噂通り2MB超 🙂
開発:あと、パッケージは main パッケージ一つにしてね、とあります。
Note that you can only compile main packages. Otherwise, you will get an object file that cannot be run in WebAssembly. If you have a package that you want to be able to use with WebAssembly, convert it to a main package and build a binary.
MacMini% GOOS=js GOARCH=wasm go run -exec="$(go env GOROOT)/misc/wasm/go_js_wasm_exec" . /usr/local/go/misc/wasm/go_js_wasm_exec: line 14: exec: node: not found exit status 127
# On macOS, this script installs to /usr/local only.
HOMEBREW_PREFIX="/usr/local"
HOMEBREW_REPOSITORY="/usr/local/Homebrew"
開発:ほらね。
基盤:どういうスクリプトなんでしょう。
# On macOS, this script installs to /usr/local only. # On Linux, it installs to /home/linuxbrew/.linuxbrew if you have sudo access # and ~/.linuxbrew otherwise. # To install elsewhere (which is unsupported) # you can untar https://github.com/Homebrew/brew/tarball/master # anywhere you like.
$ time GOOS=js GOARCH=wasm go run -exec="$(go env GOROOT)/misc/wasm/go_js_wasm_exec" . Hello, WebAssembly!
real 0m0.656s user 0m1.650s sys 0m0.159s
基盤:くっそ重いですね(笑)
開発:real より CPU が多いってどういうこと?ああ、マルチコアでのユーザ時間の和かな。
MacMini% time GOOS=js GOARCH=wasm go run -exec="$(go env GOROOT)/misc/wasm/go_js_wasm_exec" . Hello, WebAssembly! GOOS=js GOARCH=wasm go run -exec="$(go env GOROOT)/misc/wasm/go_js_wasm_exec" 1.66s user 0.31s system 189% cpu 1.036 total MacMini%
MacMini% cat mem.go package main import ( "fmt" "github.com/shirou/gopsutil/mem" ) func main() { v, _ := mem.VirtualMemory() // almost every return value is a struct fmt.Printf("Total: %v, Free:%v, UsedPercent:%f%%\n", v.Total, v.Free, v.UsedPercent) // convert to JSON. String() is also implemented fmt.Println(v) }
開発:それでは go run ...
MacMini% go run mem.go mem.go:6:8: cannot find package "github.com/shirou/gopsutil/mem" in any of: /usr/local/go/src/github.com/shirou/gopsutil/mem (from $GOROOT) /Users/ysato/go/src/github.com/shirou/gopsutil/mem (from $GOPATH)
開発:やれやれですね。では go get github.com/shirou/gopsutil/mem ... 出来ました。そして再び go run !
MacMini% time go run mem.go Total: 8589934592, Free:1008758784, UsedPercent:71.788216% go run mem.go 0.33s user 0.19s system 76% cpu 0.673 total
基盤:出ました、が、0.67秒、くっそ重い。
開発:コンパイルしましょう。
MacMini% time go build mem.go go build mem.go 0.09s user 0.21s system 83% cpu 0.359 total MacMini% time ./mem Total: 8589934592, Free:1101942784, UsedPercent:64.464474% ./mem 0.00s user 0.00s system 7% cpu 0.053 total
開発:さて楽しかったGo WebAssembly チュートリアル、一応最後まで目を通しますか。Get Going with WebAssembly ... 面白そうだけど、同時通訳とか付いてるといいな。DOM、Canvas。うーん、JavaScirpt で書くのより何がうれしいんだろう?「You can use net/http library to make HTTP requests from Go」これってどこにでもつなげるってわけじゃないんだよねきっと。Further examples。やっぱグラフィックスは面白いね。Reducing the size of Wasm files… えー、これはすごい。「At present, Go generates large Wasm files, with the smallest possible size being around ~2MB. If your Go code imports libraries, this file size can increase dramatically. 10MB+ is common.」。TinyGo「The "Hello world" example is 575 bytes. 」それはすばらしい。これはもし本気でやる時になったら要検討です。
基盤:X window server chrome extension でググる。うーん、少くとも Android を X Server にっていう話はあるようです。chrome ウェブストアで ... うーん。探し方がわからない。extension にsocketの作成やacceptが許されるのかどうか。
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/managing-users.html Managing user accounts on your Amazon Linux instance
Each Linux instance launches with a default Linux system user account. The default user name is determined by the AMI that was specified when you launched the instance. For Amazon Linux 2 or the Amazon Linux AMI, the user name is ec2-user. For CentOS, the user name is centos. For Debian, the user name is admin or root. For Fedora, the user name is ec2-user or fedora. For RHEL, the user name is ec2-user or root. For SUSE, the user name is ec2-user or root. For Ubuntu, the user name isubuntu. Otherwise, if ec2-user and root don't work, check with your AMI provider.
経理:この「You have unlimited, full-resolution photo storage with your Prime membership.」って無制限て言ってる一方で、「Need more storage?」で1TBが13,800円/年て書いてたり、意味がわかりません。形容詞がどこにかかっているのやら。