The Go gopher was designed by Renee French. (http://reneefrench.blogspot.com/) The design is licensed under the Creative Commons 3.0 Attributions license. 種々の linter が様々なプロダクトの品質を高めてきた、というのは疑う余地のない事実です。実装の初歩的な問題をエディタ内や CI/CD パイプライン中で機械的に検出できる環境を作れば、開発者はコーディングやコードレビューの邪魔になる些末な問題を早期に頭から追い出し、本質的な問題に集中できます。 また、そのような環境づくり(e.g. linter のルールセットの定義、組織独自のルールの作成、…)は、まさに開発組織のベースラインを定義する作業として捉えることができます。一度誰かが定義
Introduction Modules are how Go manages dependencies. This document is a detailed reference manual for Go’s module system. For an introduction to creating Go projects, see How to Write Go Code. For information on using modules, migrating projects to modules, and other topics, see the blog series starting with Using Go Modules. Modules, packages, and versions A module is a collection of packages th
はじめに Goにおける抽象化の方法にインターフェースがあります。インタフェースをうまく使うことにより具体的な実装を隠し、疎結合な実装ができるようになります。 これにより、テストがやりやすくなったり、リファクタリングの影響範囲を小さくできるなどのメリットがあります。インターフェースがないコードは振る舞いで共通化することができないため、冗長かつ密結合なシステムになってしまいます。 今回はGoのインターフェースの基本的な考え方である "Accept interfaces, Return structs" について紹介します。 "Accept interfaces, Return structs" とは 直訳で 「インターフェースを受け入れて、構造体を返す」 ですが、この考え方はJack Lindamood氏が過去に提案したものです。 GoのCodeReviewのドキュメントには以下のように書かれ
How to handle signals with Go to graceful shutdown HTTP server In this article we are going to learn how to handle os incoming signals for performing graceful shutdown of http server. To do so we are going to take advantage of os/signal package. Signals are primarily used on Unix-like systems. Types of signals We are going to focus on asynchronous signals. They are not triggered by program errors,
By using type parameters, you can write functions that handle incoming parameters without depending on the type specified in the function declaration. For example, the PrintSliceInts function receives a slice of integers and prints it. func PrintSliceInts(i []int) { for _, v := range i{ print(v) } } func main() { PrintSliceInts([]int {1,2,3,4,5,6,7,8,9}) } To apply the same functionality to a slic
Go 1.17 リリースに合わせて【バージョン 1.17 改訂版】とした(2021-08-21) Go 1.18 から追加・変更になった機能について追記した(2022-04-03) Go のモジュールについては自ブログでもよく話題にするのだが,差分情報が多く内容が分散しているため,ここの Zenn でまとめておく。なお,この記事では vendoring 機能については言及しないのであしからず[1]。 用語の整理 まず最初に用語の定義をしておく。 GOPATH モードとモジュール対応モード バージョン 1.11 以降から Go ツールーチェーンは以下の2つのモードのどちらかで動作する。 GOPATH モード (GOPATH mode) : バージョン 1.10 までのモード。標準ライブラリを除く全てのパッケージのコード管理とビルドを環境変数 GOPATH で指定されたディレクトリ下で行う。パ
Go Conference 2021 Springの登壇資料です アウトライン 1. 検索エンジンとは ~ 一般的な検索エンジンの仕組みと構成要素 2. 自作した検索エンジンの紹介 ~ 具体的に自作した検索エンジンの構成要素と動作例 3. 自作した検索エンジンの実装 ~ アルゴリズムとデータ構造、ライブラリ 4. おわりに ~ 検索エンジンを自作した感想
Goには「なぜ三項演算子がないの?」という意見を時々見かけます。言語開発側の意見と僕の見解をまとめていきますー。 FAQ その回答はGoのFAQに明瞭に書かれています。 Goに?:演算子がないのはなぜですか? Goには3項テスト操作がありません。 同じ結果を得るには、次を使用できます。 Goに?:がない理由は、言語の設計者が、操作が頻繁に使用されて不可解な複雑な式を作成するのを見ていたためです。 if-else形式は、長くなりますが、間違いなく明確です。 言語に必要な条件制御フロー構造は1つだけです。 ネストを許す GoもPythonもif-elseが文であり、式として扱えない方針を採りました。式として扱えないということは、一定の構文でのみ記述が可能ということです。三項演算子はその性質上式として扱えることになります。 式として扱える場合なにが書けるようになるのかというと、各項や条件に式が書
Alice Merrick 9 March 2021 Thank you for the amazing response! In 2020, we had another great turnout with 9,648 responses, about as many as 2019. Thank you for putting in the time to provide the community with these insights on your experiences using Go! New modular survey design You may notice some questions have smaller sample sizes (“n=”) than others. That’s because some questions were shown to
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く