You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
Go 1.13: xerrors 2019-04-28 Part of the Go 2 series of language changes is a new error inspection proposal. The error inspection proposal adds several features to errors that have been tried elsewhere (in packages such as github.com/pkg/errors), with some new implementation tricks. The proposal has been implemented in tip as preperation for Go 1.13. You can try it out today by working with Go from
Tyler Bui-Palsulich and Eno Compton 19 March 2019 Introduction This post is part 1 in a series. Part 1 — Using Go Modules (this post) Part 2 — Migrating To Go Modules Part 3 — Publishing Go Modules Part 4 — Go Modules: v2 and Beyond Part 5 — Keeping Your Modules Compatible Note: For documentation on managing dependencies with modules, see Managing dependencies. Go 1.11 and 1.12 include preliminary
Goのランタイムのバグを踏んで解決しました。解決までの過程を記事にします。 同じようなランタイムのバグを踏んで、小さい再現コードを作れない場合の参考にしてください。 自分のプログラムを疑う あるSlackチャンネルで Go で書かれたサーバーのクラッシュが話題になっているのを見つけました。その時に共有してもらったトレースバックです。 runtime: pointer 0xc007b8af97 to unused region of span span.base()=0xc004000000 span.limit=0xc004002000 span.state=1 fatal error: found bad pointer in Go heap (incorrect use of unsafe or cgo?) runtime stack: runtime.throw(0xc046ca,
Buffalo aims to make building new web applications in Go as simple as possible, and what could be more simple that a new application generator? $ buffalo new <name> That will generate a whole new Buffalo application that is ready to go. It'll even run go get for you to make sure you have all of the necessary dependencies needed to run your application. $ buffalo new coke Buffalo version 0.5.0 -->
Yuki Takei(noppoMan) @Tokyo-Server-Side Swift Meetup#5 Dec, 19, 2016
最近何度か聞かれたので自分がGolangでCLIツールやAPIサーバーを書くときに実践してるinterfaceを使ったテスト技法について簡単に書いておく.まずはinterfaceを使ったテストの基本について説明し次に自分が実践している簡単なテクニックをいくつか紹介する. なおGolangのテストの基本については @suzuken さんによる「みんなのGo言語」 の6章が最高なので今すぐ買ってくれ! 前提 自分はテストフレームワークや外部ツールは全く使わない.標準のtestingパッケージのみを使う.https://golang.org/doc/faq#Packages_Testing にも書かれているようにテストのためのフレームワークを使うことは新たなMini language(DSL)を導入することと変わらない.最初にそれを書く人は楽になるかもしれないが新しくプロジェクトに参入してきたひ
golang のテストツールには標準でベンチマークツールが付属しています。例えば、引数 n を貰ってその数分だけメッセージの入ったスライスを返す関数 makeSlice が以下の実装だったとします。 foo.go package foo import "fmt" func makeSlice(n int) []string { var r []string for i := 0; i < n; i++ { r = append(r, fmt.Sprintf("%03d だよーん", i)) } return r } 如何にも遅そうなコードですね。まずはこのコードを単品で計測するベンチマークを書きます。 foo_test.go package foo import "testing" func BenchmarkMakeSlice(b *testing.B) { b.ResetTimer()
Do you enjoy playing slots but sometimes feel like you’re not sure what to do? Do you find yourself asking […]
golang では配列をソートしたい場合に癖があり、Int や Float64、String といった固定の型であれば sort パッケージが提供する関数でソートが可能でしたが、独自の型や Int64 等といった sort パッケージが用意していない型の配列をソートするには Sorter というインタフェースを備えた型で扱うしかありませんでした。 package main import ( "fmt" "sort" ) type Food struct { Name string Price int } type Foods []Food func (f Foods) Len() int { return len(f) } func (f Foods) Less(i, j int) bool { return f[i].Price < f[j].Price } func (f Foods
Automatic C-Go Bindings Generator The c-for-go project allows to reuse existing C/C++ libraries in your Go applications, by automatically creating c-go bindings for a given set of C headers and the manifest file. $ cloc vorbis/ Language files blank comment code C/C++ Header 6 192 497 578 $ c-for-go vorbis.yml processing vorbis.yml... done in 304.657793ms $ cl
Getting into robotics as a software engineer Books 2022 A Couple Small Nix Tips Privacy-conscious Home Automation There is no Magic 2021 Spreadsheet Formulas for Personal Finance Volunteering for the Informatics Olympiad CVE-2021-1831 Shortcuts File Read Outside of Sandbox Quote Books Clubhouse Getting TLS certs locally because why not The M1 MacBook Air is the best computer I've ever owned 2020:
Go1.7ではgolang.org/x/net/contextがcontextパッケージとして標準パッケージに仲間入りする.そしていくつかの標準パッケージではcontextパッケージを使ったメソッド/関数も新たに登場する.contextパッケージは今後さらに重要な,Gopherは普通に扱うべき,パッケージになると考えられる.本記事ではそもそもcontextパッケージとは何か?なぜ登場したのか?なぜ重要なのか?どのように使うべきか?についてまとめる. contextパッケージが初めて紹介されたのは2014年のThe Go Blogの記事 “Go Concurrency Patterns: Context”である.この記事ではなぜGoogleがcontextパッケージを開発したのか,どのように使うのか具体的な検索タスクを例に解説されている.まだ読んだことがない人はそちらを先に読むと良い. co
5年前に買った『Java並行処理プログラミング ―その「基盤」と「最新API」を究める―』をようやく読んだ。買った頃には Perl やシンプルな JavaScript ばかり書いていたので並行プログラミングなんてほとんど気にすることがなく、実感がなくて読むのも途中で止まってしまっていた本で、家を掃除しているときに見つけたもの。その後も趣味で Android アプリを書くなど Java に触れる機会はあったけれど、せいぜいが AsyncTask を使うくらいで、マルチスレッドを強く意識してコードを書くこともなかった。 Java並行処理プログラミング ―その「基盤」と「最新API」を究める― 作者: Brian Goetz,Joshua Bloch,Doug Lea出版社/メーカー: ソフトバンククリエイティブ発売日: 2006/11/22メディア: 単行本購入: 30人 クリック: 442回
Go言語のDependency/Vendoringは長く批判の的になってきた(cf. “0x74696d | go get considered harmful”, HN).Go1.5からは実験的にVendoringの機能が入り,サードパーティからはDave Chaney氏を中心としてgbというプロジェクベースのビルドツールが登場している.なぜこれらのリリースやツールが登場したのか?それらはどのように問題を解決しようとしているのか?をつらつらと書いてみる. Dependencyの問題 最初にGo言語におけるDependecy(依存解決)の問題についてまとめる.Go言語のDependencyで問題なのはビルドの再現性が保証できないこと.この原因はimport文にある. Go言語で外部パッケージを利用したいときはimport文を使ってソースコード内にそれを記述する.このimport文は2通りの
« ソースに一行追加するだけですべての HTTP 通信が環境変数指定のプロキシではなくIEの設定になるモジュールを書いた #golang | Main | golang で vimgirl bot を書いた。 » GoLangでJavaのenumっぽいライブラリ作った話 - おいぬま日報 なんとかなるわけなんだけど、これを毎回書くのは面倒なので... もっと良いやり方があったらぜひ教えて欲しいところです。 http://oinume.hatenablog.com/entry/introducing-goenum golang でユーザ型の値を文字列化する場合 Stringer というインタフェースを実装します。具体的には func (l Lang) String() string { switch l { case Go: return "Go" case Python: return "
Introduction Welcome to Building Web Apps with Go! If you are reading this then you have just started your journey from noob to pro. No seriously, web programming in Go is so fun and easy that you won't even notice how much information you are learning along the way! Keep in mind that there are still portions of this book that are incomplete and need some love. The beauty of open source publishing
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く