Closed hgsgtk closed 1 year ago
先にGo 1.17 ネタで気になったやつを書くためにissueを増やしてみた
Go 1.17 (次回のネタの先行集めをしてみる)
https://tip.golang.org/doc/go1.17
To facilitate the upgrade to Go 1.17 pruned module graphs, the go mod tidy subcommand now supports a -go flag to set or change the go version in the go.mod file. To convert the go.mod file for an existing module to Go 1.17 without changing the selected versions of its dependencies, run:
humuhumu
https://tip.golang.org/ref/mod#graph-pruning Module graph pruning
Minor changesめっちゃあるな
以降 @hgsgtk 的に気になった内部実装をぽちぽちいれていく
https://tip.golang.org/doc/go1.17#os
The File.WriteString method has been optimized to not make a copy of the input string.
ユーザーとしても参考になりそう
po3rinさんが好きそうな話題が見受けられる
The strconv package now uses Ulf Adams's Ryū algorithm for formatting floating-point numbers. This algorithm improves performance on most inputs and is more than 99% faster on worst-case inputs.
Ulf Adams's Ryū algorithm なにこれたのしそう
https://tip.golang.org/doc/go1.17#strconv
The new T.Setenv and B.Setenv methods support setting an environment variable for the duration of the test or benchmark.
うれしいねぇ
https://tip.golang.org/doc/go1.17#testing
https://tip.golang.org/doc/go1.17#time
The package now accepts comma "," as a separator for fractional seconds when parsing and formatting time. The following time formats are now accepted:
2006-01-02 14:06:03,999999999 -0700 MST Mon Jan _2 14:06:03,120007 2006 Mon Jan 2 14:06:03,120007 2006
The new constant Layout defines the reference time.
commaオッケーにしたよとかそういう細かすぎて気づかんみたいなやつ好き、にこにこしちゃう
https://tip.golang.org/doc/go1.17#flag
Flag declarations now panic if an invalid name is specified.
コードをサクッと読んでふ〜んってする分にはたのしそう
リリーーーーーーーーーーーす
https://blog.golang.org/go1.17 https://golang.org/doc/go1.17
mattenパイセンの早巡り https://twitter.com/mattn_jp/status/1427423861012787202 zcheeパイセンの早巡り https://twitter.com/_zchee_/status/1427653240825413635
来週(8/23の週)に開催予定として日程調整を作りました!!! https://chouseisan.com/s?h=1871b829632f4c1b89d28abb0d42e52b
~8/26(木) 15:00〜16:00 にしましょう!!!!!!!!!!!~
絶対に参加しないといけないやーつが15:30〜16:00に入っていたので、14:30~15:30(遅刻可能)ってことにさせてください 🙇 🙇 🙇
とりあえず着席
uberたのんで着席
やるぞ!!
もう少し増えるかな?人数揃うまでmattnさんたちのツイートを眺めてみる
https://twitter.com/mattn_jp/status/1427426169465413632 tools.go不要になるかもしれない。
go run がバージョン指定できる様になった。安定バージョンでお届けが可能に。
$ go run example.com/cmd@v1.0.0
zoom linkを 🙏
1.17にアップデートするときの要注意。 https://twitter.com/mattn_jp/status/1427427593955930159
net/url のセミコロンの扱いが変わる。
example?a=1;b=2&c=3
こういうの。これに伴い、net/http でセミコロンを扱う場合には AllowQuerySemicolons を使ってラップする必要がある。
[余談]
go.dev で3rdパーティのライブラリもメソッドなどが追加されたバージョンが見れるようになった。 https://pkg.go.dev/github.com/gorilla/mux#SetURLVars
これみれば仕組みわかるのかな。。。? https://github.com/golang/website
https://play.golang.org/p/WbuWrQqJjeR すげえええ
package main
import (
"fmt"
"time"
)
func main() {
fmt.Println(time.Now().GoString()) // time.Date(2009, time.November, 10, 23, 0, 0, 0, time.Local)
}
月のconstあったんだ
ISUCON余談ん
http://dsas.blog.klab.org/archives/52191467.html
https://blog.agatan.dev/posts/isucon11-qualify
interpolateParams
使って動的プレースホルダを云々するとパフォーマンス上がるらしい。
https://twitter.com/mattn_jp/status/1427435182051659777
go test に -shuffle
あ、そうそう。Go 1.17 から go get で実行バイナリをインストールしようとすると警告が表示される。今後は
$ go install cmd@version
tests := map[string]struct
で for name, tt := range tests {
すると map
を回すようになるので順不同になるハック
https://play.golang.org/p/SChUDfSesbj
https://pkg.go.dev/time#Time.UnixMicro
https://future-architect.github.io/articles/20210820a/
https://pkg.go.dev/sync/atomic#Value
CompareAndSwap
とか増えてatomicな操作を書きやすくなった!!
可能性を感じるpkgだ…
https://pkg.go.dev/runtime/metrics#example-Read-ReadingOneMetric https://pkg.go.dev/runtime/metrics#Read
package main
import (
"fmt"
"runtime/metrics"
)
func main() {
// Name of the metric we want to read.
const myMetric = "/memory/classes/heap/free:bytes"
// Create a sample for the metric.
sample := make([]metrics.Sample, 1)
sample[0].Name = myMetric
// Sample the metric.
metrics.Read(sample)
// Check if the metric is actually supported.
// If it's not, the resulting value will always have
// kind KindBad.
if sample[0].Value.Kind() == metrics.KindBad {
panic(fmt.Sprintf("metric %q no longer supported", myMetric))
}
// Handle the result.
//
// It's OK to assume a particular Kind for a metric;
// they're guaranteed not to change.
freeBytes := sample[0].Value.Uint64()
fmt.Printf("free but not released memory: %d\n", freeBytes)
}
refelctもしやすくなった!!! https://golang.org/doc/go1.17#reflect
ISUCONでうまくv4.0のバージョンが取れなかったライブラリ https://github.com/plutov/echo-logrus
うーん、厳しいライブラリだった…nrhd.... https://github.com/plutov/echo-logrus/pull/6/files
コピればよかったか(OSS利用者としてあるまじき発言)
contextからdeadlineを取り消してくれるやつ
runtime/metrics pkgで自作プロファイラ作れそうだな
https://twitter.com/__achille__/status/1431014148800802819?s=21
でかいサイズのデータ処理するシステムとかで15%早くなったという話が
https://formulae.brew.sh/formula/go
homebrewにもgo1.17
8/26(木) 14:30〜15:30@ Zoom, BASE BANK, Inc.
日程未定
調整さん https://chouseisan.com/s?h=1871b829632f4c1b89d28abb0d42e52b
参加者
お題