今年作った/メンテしたGoツールN選
TIME rest time current/total
TopicsPlaceHolder

今年作った/メンテしたGoツールN選

golang.tokyo 11

Dec 11th, 2017

Profile

songmu

Mackerel

Mackerel

【宣伝】書籍発売中

【宣伝】みんなのGo言語

今年書いたりメンテナンスしたりしたGoプロダクト

horenso

go-httpdate

go-httpdate (supported formats)

go-httpdate (synopsis)

// try to parse string and returns `time.Time` or error
t1, err := httpdate.Str2Time("Thu, 03 Feb 1994 12:33:44 GMT", time.UTC)
t2, err := httpdate.Str2Time("2017-11-11", time.UTC)
t3, err := httpdate.Str2Time("Thu Nov  9 18:20:31 GMT 2017", time.UTC)
t4, err := httpdate.Str2Time("08-Feb-94 14:15:29 GMT", time.UTC)

go-httpdate

go-httpdate (httpdate command available)

httpdateコマンドが付属。

% httpdate '2017-12-12'
1513004400

ghg

ghg (Why do not you use a go get?)

ghg (synopsis)

ghg (back story)

これが、 mkr plugin install の元になりました。

hakobe/paranoidhttp

hakobe/paranoidhttp

hakobe/paranoidhttp

go-memcached-tool

go-memcached-tool

go-memcached-tool

Slabの状態を見る

% go-memcached-tool 127.0.0.1:11211
  #  Item_Size  Max_age   Pages   Count   Full?  Evicted Evict_Time OOM
  1      96B  17550349s       1   10922     yes  1121115        0    0
  2     120B  17529950s       3   26214     yes  2693486        0    0
  3     152B  17656340s       2   13793     yes  1262170        0    0
  4     192B  17652024s       2   10917     yes   139583        0    0
  ...

go-memcached-tool

Dumpして、別のmemcachedに移す

% go-memcached-tool 127.0.0.1:11211 dump | nc cache2.example.com:11211

motemen/blogsync

ghch

axslogparser

postailer

go-ltsv

timeout

context対応したい

timeout

mackerel-agent内部で利用

tio := &timeout.Timeout{
    Cmd:            exec.Command("perl", "-E", "say 'Hello'"),
    Duration:       10 * time.Second,
    KillAfter:      5 * time.Second,
}
exitStatus, stdout, stderr, err := tio.Run()

retry

retry (synopsis)

mackerel-agent内部で利用

err := retry.Retry(3, 1*time.Second, func() error {
    // return error once in a while
})
if err != nil {
    // error handling
}