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.
The Go Playground この記事は Go Advent Calendar 2018 8日目の記事です。 はじめに Goで簡単にコードを書いて共有するときはThe Go Playgroundを利用することが多いと思いますが、実は隠れ機能みたいなものがあるので今回はそれを紹介します。 The Go Playground テストコードの実行 https://play.golang.org/ のページを開くと、下記のようにmain関数が用意されたPlaygroundが開きます。これだけだとmain関数をメイン処理として記述しなければならないと思いますが、全くこれ通りでなくても動くことが About に記述されています。 If the program contains tests or examples and no main function, the service runs the
Goで作られるプログラムサイズはそこそこ大きい。配布する場合はやはり小さい方が良い。 そんなときは、リンカの設定を利用するといいようだ。 1 go build -ldflags '-s -w' Linuxならバイナリサイズが小さくなるはずだ。拙作、comstockでは8MiBから5.2MiBに縮んだ。 何をやっているか? -ldflagsは、gccなどを使ったことある方はよくご存知だろうが、ldへの引数である。 ldとはgccが使うリンカであり、Goもリンカを持っている。Goのリンカは、例えば、go tool 6l(番号はアーキテクチャ依存)から呼び出せる。伝統的にリンカへのフラグは LDFLAGSであるので、goでは小文字で指定するようになってる。 go buildはリンカへの引数を-ldflagsの後で文字列として渡すことができる。 指定できるリンカフラグは様々で、標準ドキュメントより
Go の標準パッケージである net/http を使えば簡単に HTTP サーバーを立てることができる。とは言うものの、自分はそのへんが実際どうなってるのか全然わかってない。つらい。ということで、Go の勉強も兼ねて net/http の動きを少しだけ追ってみることにした。 まず、net/http を用いたよく見かけるサンプルコードを書いてみる。 package main import ( "fmt" "log" "net/http" ) func poyo(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "poyo!") } func main() { http.HandleFunc("/", poyo) if err := http.ListenAndServe(":9090", nil); err != nil { l
キャリアを充実させる『カギ』に!PR TIMES CTO金子達哉から学ぶアウトプット術 / output_method
Goに入ってはGoに従え Go Conference 2014 autumn 30 November 2014 鵜飼文敏 Fumitoshi Ukai Google Software Engineer - Chrome Infra team Go Readability Approver Go言語のReadabilityをレビューするチーム コードレビューを通じてGo言語のよいコードの書きかたを教える メインのプロジェクトとは別のコードをレビュー 一年前くらい前に参加して 20% timeで 200くらいのCLをレビューしました 今は一日3CLくらい、週に12CLほどのペースでやっています Gopher by Renée French 2 Readabilityスキルとは? プログラミング言語のリテラシー 作法にかなったやりかた で、読んだり書いたりできる能力 言語ごとに作法が違う C++
The Laws of Reflection(Reflectionの法則について) Introduction(はじめに) コンピューティングにおけるReflectionはプログラム自身が自分の構造(特に型について)を調査するための機能で、メタプログラミングの方式の一つです Reflection in computing is the ability of a program to examine its own structure, particularly through types; it's a form of metaprogramming. It's also a great source of confusion. 本記事はGoにおけるreflectionの動きを説明することによってメタプログラミングについて明らかにできるかを試みています。 In this article we
いまはもっと賢くなってる。最適化バンザイ https://medium.com/a-journey-with-go/go-string-conversion-optimization-767b019b75ef 概要 string を byte スライスにしたり,またその逆だったりをおこなうのに, なんてコードをよく書きます.string は読み込み専用のスライスみたいな物だという認識だったので,キャストしても,ポインタがコピーされるだけで,必要になったらコピーされるだろうぐらいに思ってたんですが,調べてみたらメモリがまるっとコピーされるのでパフォーマンスに影響しそうなときは要注意です. 詳細 string を byte スライスにキャストするプログラムを書いて,アセンブリコードを吐かせてみました.
Similar to any other large communities it becomes increasingly hard to find quality packages for any given task, so this is simply a list of ones that I’ve needed and found to be useful for my projects. Go’s standard library is pretty fantastic so this list is short for now, I’ll try and remember to update it as I Go! dustin/go-humanize — format times, numbers, bytesizes, relative datesvisionmedia
Update this post is also available in Japanese. This is a post about an experimental tool that I have been working on. gcvis is a simple way of visualising the operation of the garbage collector within a Go process. Here is a screenshot of it in operation. The rest of this article explores how gcvis works and how to interpret its results. How does gcvis get the data ? There are a few ways you can
Libraries for implementing authentication schemes. authboss - Modular authentication system for the web. It tries to remove as much boilerplate and "hard things" as possible so that each time you start a new web project in Go, you can plug it in, configure it, and start building your app without having to build an authentication system each time. branca - branca token specification implementation
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く