{"id":21189649,"url":"https://github.com/sky0621/tips-go","last_synced_at":"2025-04-13T18:15:30.155Z","repository":{"id":56007166,"uuid":"71388480","full_name":"sky0621/tips-go","owner":"sky0621","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-10T16:31:59.000Z","size":76762,"stargazers_count":0,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T18:15:13.048Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sky0621.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-19T18:42:25.000Z","updated_at":"2025-04-10T16:32:04.000Z","dependencies_parsed_at":"2025-04-04T14:33:02.767Z","dependency_job_id":null,"html_url":"https://github.com/sky0621/tips-go","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sky0621%2Ftips-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sky0621%2Ftips-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sky0621%2Ftips-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sky0621%2Ftips-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sky0621","download_url":"https://codeload.github.com/sky0621/tips-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248758419,"owners_count":21156957,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-20T18:53:17.728Z","updated_at":"2025-04-13T18:15:30.149Z","avatar_url":"https://github.com/sky0621.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tips-go\n\n```\ngo mod init github.com/sky0621/tips-go/xxxx\n```\n\n## 3rd party library の実ソースを保持しておきたい場合\n\n```\ngo mod vendor\n```\n\n## 100 Go Mistakes and How to Avoid Them\n\n### interface\n\nhttps://100go.co/5-interface-pollution/\n\nWhen to use interfaces\n- Common behavior\n- Decoupling\n- Restricting behavior\n\n```\nRob Pike\nThe bigger the interface, the weaker the abstraction.\n```\n\n```\nRob Pike\nDon’t design with interfaces, discover them.\n```\n\n### generics\n\nhttps://100go.co/9-generics/\n\n### 誤ったプロジェクト構成 (プロジェクト構造とパッケージ構成)\n\n- プロジェクトが過度に複雑になる可能性があるため、時期尚早なパッケージ化は避けるべき\n- 1 つまたは 2 つのファイルだけを含む数十のナノパッケージを作成することは避けるべき\n- パッケージ名は短く、簡潔で、表現力豊かで、慣例により単一の小文字にする必要があります\n- エクスポートする必要があるものをできる限り最小限に抑える必要があります\n\nhttps://go.dev/doc/modules/layout\n\n### linter\n\n- [Go言語の標準コードアナライザー](https://golang.org/cmd/vet)\n- [エラーチェッカー](https://github.com/kisielk/errcheck)\n- [循環的複雑度アナライザー](https://github.com/fzipp/gocyclo)\n- [複数回使用文字列アナライザー](https://github.com/jgautheron/goconst)\n- [golangci-lint](https://github.com/golangci/golangci-lint)\n\n### formatter\n\n- [Go言語の標準コードフォーマッター](https://golang.org/cmd/gofmt)\n- [Go言語の標準インポートフォーマッター](https://godoc.org/golang.org/x/tools/cmd/goimports)\n\n### 整数オーバーフローのチェック\n\nhttps://github.com/teivah/100-go-mistakes/blob/master/src/03-data-types/18-integer-overflows/main.go\n\n### Slice\n\nhttps://100go.co/20-slice/\n\n### Receiver\n\nhttps://100go.co/#not-knowing-which-type-of-receiver-to-use-42\n\n```\n値レシーバーとポインタレシーバーのどちらを使用するかは、\nどの型なのか、変化させる必要があるかどうか、コピーできないフィールドが含まれているかどうか、\nオブジェクトはどれくらい大きいのか、などの要素に基づいて決定する必要があります。\n\n通常は、そうしない正当な理由がない限り、値レシーバーを使用して間違いありません。\n分からない場合は、ポインタレシーバを使用してください。\n```\n\n```\nポインタレシーバーでなければならない とき\n\n・メソッドがレシーバーを変化させる必要がある場合。\n　このルールは、受信側がスライスであり、メソッドが要素を追加する必要がある場合にも有効です。\n・メソッドレシーバーにコピーできないフィールドが含まれている場合。\n```\n\n```\nポインタレシーバーであるべき とき\n\n・レシーバーが大きなオブジェクトの場合。\n　ポインタを使用すると、大規模なコピーの作成が防止されるため、呼び出しがより効率的になります。\n```\n\n```\n値レシーバーでなければならない とき\n\n・レシーバーの不変性を強制する必要がある場合。\n・レシーバーがマップ、関数、チャネルの場合。\n　それ以外の場合はコンパイルエラーが発生します。\n```\n\n```\n値レシーバーであるべき とき\n\n・レシーバーが変化させる必要のないスライスの場合。\n・レシーバーが、time.Time などの小さな配列または構造体で、可変フィールドを持たない値型である場合。\n・レシーバーが int、float64、または string などの基本型の場合。\n```\n\n### Concurrency\n\nhttps://100go.co/56-concurrency-faster/\n\n## ref\n\nhttps://100go.co/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsky0621%2Ftips-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsky0621%2Ftips-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsky0621%2Ftips-go/lists"}