From b0657ab84ccea1a4a479424c8bf755ab91b6073b Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 14 Dec 2023 22:14:45 -0500 Subject: [PATCH] wiki: redirect everything to go.dev/wiki For #61940. --- AVX512.md | 287 +-- Articles.md | 264 +-- AssemblyPolicy.md | 15 +- Benchmarks.md | 67 +- Blogs.md | 86 +- Books.md | 1043 +-------- BoundingResourceUse.md | 28 +- CSSStyleGuide.md | 220 +- ChromeOS.md | 46 +- CodeReview.md | 54 +- CodeReviewComments.md | 617 +---- CodeReviewConcurrency.md | 248 +- CodeTools.md | 69 +- Comments.md | 38 +- CommitMessage.md | 79 +- CommonMistakes.md | 142 +- CompilerOptimizations.md | 115 +- Conferences.md | 173 +- Configuring-GoLand-for-WebAssembly.md | 51 +- Contributing-to-gopls.md | 9 +- CoreDumpDebugging.md | 150 +- Courses.md | 86 +- CreatingSubRepository.md | 26 +- CustomPprofProfiles.md | 99 +- Darwin.md | 21 +- DashboardBuilders.md | 105 +- Deprecated.md | 55 +- DesignDocuments.md | 62 +- Diagnostics.md | 5 +- ...ad-build-farm-failed-logs-and-debugging.md | 15 +- DragonFly-BSD.md | 19 +- ErrorValueFAQ.md | 145 +- Errors.md | 102 +- ExperienceReports.md | 259 +-- FileTreeDocumentation.md | 85 +- FreeBSD.md | 18 +- FromXToGo.md | 77 +- Frozen.md | 33 +- Fuzzing-trophy-case.md | 32 +- GOPATH.md | 78 +- Gardening.md | 61 +- GcToolchainTricks.md | 108 +- GccgoCrossCompilation.md | 110 +- GerritAccess.md | 64 +- GerritBot.md | 78 +- GithubAccess.md | 27 +- Go-1.10-Release-Party.md | 101 +- Go-1.6-release-party.md | 170 +- Go-1.8-Release-Party.md | 147 +- Go-Community-Slides.md | 27 +- Go-Release-Cycle.md | 174 +- Go2.md | 49 +- Go2ErrorHandlingFeedback.md | 277 +-- Go2ErrorValuesFeedback.md | 58 +- Go2GenericsFeedback.md | 366 +-- GoArm.md | 1595 +------------ GoForCPPProgrammers.md | 683 +----- GoGenerateTools.md | 36 +- GoGetProxyConfig.md | 26 +- GoGetTools.md | 12 +- GoMips.md | 96 +- GoStrings.md | 59 +- GoTalks.md | 391 +--- GoUserGroups.md | 234 +- GoUsers.md | 1880 +-------------- Gomote.md | 230 +- Gopher.md | 19 +- HandlingIssues.md | 92 +- Home.md | 248 +- HostedContinuousIntegration.md | 15 +- How-to-ask-for-help.md | 60 +- HowToAsk.md | 112 +- IDEsAndTextEditorPlugins.md | 62 +- InstallFromSource.md | 27 +- InstallTroubleshooting.md | 72 +- InterfaceSlice.md | 42 +- InvalidFlag.md | 23 +- Iota.md | 41 +- LUCI.md | 33 +- Learn.md | 53 +- LearnConcurrency.md | 47 +- LearnErrorHandling.md | 23 +- LearnServerProgramming.md | 124 +- LearnTesting.md | 11 +- Linux.md | 13 +- LinuxKernelSignalVectorBug.md | 263 +-- Livestreams.md | 29 +- LockOSThread.md | 49 +- LoopvarExperiment.md | 228 +- MacOS12BSDThreadRegisterIssue.md | 31 +- MethodSets.md | 137 +- MinimumRequirements.md | 147 +- MinorReleases.md | 69 +- Mobile.md | 231 +- Modules.md | 1451 +----------- MutexOrChannel.md | 34 +- NetBSD.md | 28 +- NewSpeakers.md | 49 +- NoPlusOne.md | 31 +- NonEnglish.md | 71 +- OpenBSD.md | 67 +- PGO-Tools.md | 13 +- PackagePublishing.md | 130 +- PanicAndRecover.md | 89 +- PerfDashboard.md | 63 +- Performance.md | 677 +----- Plan9.md | 178 +- Podcasts.md | 29 +- PortingPolicy.md | 96 +- PriorDiscussion.md | 60 +- Projects.md | 2042 +---------------- Proposals.md | 5 +- ProviderIntegration.md | 22 +- Questions.md | 25 +- Quiet-Weeks.md | 13 +- Range.md | 56 +- RangefuncExperiment.md | 283 +-- RateLimiting.md | 71 +- ResearchPapers.md | 458 +--- ...ving-Problems-From-Modified-Module-Path.md | 167 +- Resources-for-slog.md | 59 +- SQLDrivers.md | 77 +- SQLInterface.md | 184 +- Screencasts.md | 265 +-- SettingGOPATH.md | 88 +- SignalHandling.md | 29 +- SimultaneousAssignment.md | 18 +- SliceTricks.md | 309 +-- SlowBots.md | 76 +- Solaris.md | 7 +- Spectre.md | 53 +- Spelling.md | 13 +- Style.md | 6 +- SuccessStories.md | 51 +- Switch.md | 248 +- TableDrivenTests.md | 127 +- TargetSpecific.md | 93 +- TestComments.md | 291 +-- TestFailures.md | 190 +- Timeouts.md | 25 +- Training.md | 33 +- Ubuntu.md | 35 +- Watchflakes.md | 179 +- WebAccessibilityResourcesAndTips.md | 40 +- Well-known-struct-tags.md | 51 +- WhyGo.md | 81 +- Windows.md | 19 +- WindowsBuild.md | 63 +- WindowsCrossCompiling.md | 118 +- WindowsDLLs.md | 130 +- X-Repositories.md | 26 +- _Footer.md | 7 +- cgo.md | 382 +-- golang-tools.md | 104 +- gopherbot.md | 41 +- gopls-integrator-FAQ.md | 9 +- gopls.md | 8 +- heapdump13.md | 183 +- heapdump14.md | 178 +- heapdump15-through-heapdump17.md | 206 +- heapdump15.md | 5 +- 161 files changed, 339 insertions(+), 24459 deletions(-) diff --git a/AVX512.md b/AVX512.md index dd1130a8..60422a1f 100644 --- a/AVX512.md +++ b/AVX512.md @@ -1,287 +1,4 @@ -Go 1.11 release introduces [AVX-512](https://en.wikipedia.org/wiki/AVX-512) support. -This page describes how to use new features as well as some important encoder details. +The Go wiki on GitHub has moved to go.dev (#61940). -### Terminology +Try or . -Most terminology comes from [Intel Software Developer's manual](https://software.intel.com/en-us/articles/intel-sdm). -Suffixes originate from Go assembler syntax, which is close to AT&T, which also uses size suffixes. - -Some terms are listed to avoid ambiguity (for example, opcode can have different meanings). - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TermDescription
Operand - Same as "instruction argument". -
Opcode - Name that refers to instruction group. For example, VADDPD is an opcode.
- It refers to both VEX and EVEX encoded forms and all operand combinations.
- Most Go assembler opcodes for AVX-512 match Intel manual entries, with exceptions for cases
- where additional size suffix is used (e.g. VCVTTPD2DQY is VCVTTPD2DQ). -
Opcode suffix - Suffix that overrides some opcode properties. Listed after "." (dot).
- For example, VADDPD.Z has "Z" opcode suffix.
- There can be multiple dot-separated opcode suffixes. -
Size suffix - Suffix that specifies instruction operand size if it can't be inferred from operands alone.
- For example, VCVTSS2USIL has "L" size suffix. -
Opmask - Used for both {k1} notation and to describe instructions that have K registers operands.
- Related to masking support in EVEX prefix. -
Register block - Multi-source operand that encodes register range.
- Intel manual uses +n notation for register blocks.
- For example, +3 is a register block of 4 registers. -
FPFloating-point
- -### New registers - -EVEX-enabled instructions can access additional 16 `X` (128-bit xmm) and `Y` (256-bit ymm) registers, plus 32 new `Z` (512-bit zmm) registers in 64-bit mode. 32-bit mode only gets `Z0-Z7`. - -New opmask registers are named `K0-K7`. -They can be used for both masking and for special opmask instructions (like `KADDB`). - -### Masking support - -Instructions that support masking can omit `K` register operand. -In this case, `K0` register is implied ("all ones") and merging-masking is performed. -This is effectively "no masking". - -`K1-K7` registers can be used to override default opmask. -`K` register should be placed right before destination operand. - -Zeroing-masking can be activated with `Z` opcode suffix. Zeroing-masking requires that a mask register other than K0 be specified. - -For example, `VADDPD.Z (AX), Z30, K3, Z10` uses zeroing-masking and explicit `K` register. -- If `Z` opcode suffix is removed, it's merging-masking with `K3` mask. -- If `K3` operand is removed, it generates an assembler error. -- If both `Z` opcode suffix and `K3` operand are removed, it is merging-masking with `K0` mask. - -It's compile-time error to use `K0` register for `{k1}` operands (consult [manuals](https://software.intel.com/en-us/articles/intel-sdm) for details). - -### EVEX broadcast/rounding/SAE support - -Embedded broadcast, rounding and SAE activated through opcode suffixes. - -For reg-reg FP instructions with `{er}` enabled, rounding opcode suffix can be specified: - -* `RU_SAE` to round towards +Inf -* `RD_SAE` to round towards -Inf -* `RZ_SAE` to round towards zero -* `RN_SAE` to round towards nearest - -> To read more about rounding modes, see [MXCSR.RC info](http://qcd.phys.cmu.edu/QCDcluster/intel/vtune/reference/vc148.htm). - -For reg-reg FP instructions with `{sae}` enabled, exception suppression can be specified with `SAE` opcode suffix. - -For reg-mem instrictons with `m32bcst/m64bcst` operand, broadcasting can be turned on with `BCST` opcode suffix. - -Zeroing opcode suffix can be combined with any of these. -For example, `VMAXPD.SAE.Z Z3, Z2, Z1` uses both `Z` and `SAE` opcode suffixes. -It is important to put zeroing opcode suffix last, otherwise it is a compilation error. - -### Register block (multi-source) operands - -Register blocks are specified using register range syntax. - -It would be enough to specify just first (low) register, but Go assembler requires -explicit range with both ends for readability reasons. - -For example, instructions with `+3` range can be used like `VP4DPWSSD Z25, [Z0-Z3], (AX)`. -Range `[Z0-Z3]` reads like "register block of Z0, Z1, Z2, Z3". -Invalid ranges result in compilation error. - -### AVX1 and AVX2 instructions with EVEX prefix - -Previously existed opcodes that can be encoded using EVEX prefix now can access AVX-512 features like wider register file, zeroing/merging masking, etc. For example, `VADDPD` can now use 512-bit vector registers. - -See [encoder details](#encoder-details) for more info. - -### Supported extensions - -Best way to get up-to-date list of supported extensions is to do `ls -1` inside [test suite](https://github.com/golang/go/tree/master/src/cmd/asm/internal/asm/testdata/avx512enc) directory. - -Latest list includes: -``` -aes_avx512f -avx512_4fmaps -avx512_4vnniw -avx512_bitalg -avx512_ifma -avx512_vbmi -avx512_vbmi2 -avx512_vnni -avx512_vpopcntdq -avx512bw -avx512cd -avx512dq -avx512er -avx512f -avx512pf -gfni_avx512f -vpclmulqdq_avx512f -``` - -128-bit and 256-bit instructions additionally require `avx512vl`. -That is, if `VADDPD` is available in `avx512f`, you can't use `X` and `Y` arguments -without `avx512vl`. - -Filenames follow `GNU as` (gas) conventions. -[avx512extmap.csv](https://gist.github.com/Quasilyte/92321dadcc3f86b05c1aeda2c13c851f) can make naming scheme more apparent. - -### Instructions with size suffix - -Some opcodes do not match Intel manual entries. -This section is provided for search convenience. - -| Intel opcode | Go assembler opcodes | -|--------------|----------------------| -| `VCVTPD2DQ` | `VCVTPD2DQX`, `VCVTPD2DQY` | -| `VCVTPD2PS` | `VCVTPD2PSX`, `VCVTPD2PSY` | -| `VCVTTPD2DQ` | `VCVTTPD2DQX`, `VCVTTPD2DQY` | -| `VCVTQQ2PS` | `VCVTQQ2PSX`, `VCVTQQ2PSY` | -| `VCVTUQQ2PS` | `VCVTUQQ2PSX`, `VCVTUQQ2PSY` | -| `VCVTPD2UDQ` | `VCVTPD2UDQX`, `VCVTPD2UDQY` | -| `VCVTTPD2UDQ` | `VCVTTPD2UDQX`, `VCVTTPD2UDQY` | -| `VFPCLASSPD` | `VFPCLASSPDX`, `VFPCLASSPDY`, `VFPCLASSPDZ` | -| `VFPCLASSPS` | `VFPCLASSPSX`, `VFPCLASSPSY`, `VFPCLASSPSZ` | -| `VCVTSD2SI` | `VCVTSD2SI`, `VCVTSD2SIQ` | -| `VCVTTSD2SI` | `VCVTSD2SI`, `VCVTSD2SIQ` | -| `VCVTTSS2SI` | `VCVTSD2SI`, `VCVTSD2SIQ` | -| `VCVTSS2SI` | `VCVTSD2SI`, `VCVTSD2SIQ` | -| `VCVTSD2USI` | `VCVTSD2USIL`, `VCVTSD2USIQ` | -| `VCVTSS2USI` | `VCVTSS2USIL`, `VCVTSS2USIQ` | -| `VCVTTSD2USI` | `VCVTTSD2USIL`, `VCVTTSD2USIQ` | -| `VCVTTSS2USI` | `VCVTTSS2USIL`, `VCVTTSS2USIQ` | -| `VCVTUSI2SD` | `VCVTUSI2SDL`, `VCVTUSI2SDQ` | -| `VCVTUSI2SS` | `VCVTUSI2SSL`, `VCVTUSI2SSQ` | -| `VCVTSI2SD` | `VCVTSI2SDL`, `VCVTSI2SDQ` | -| `VCVTSI2SS` | `VCVTSI2SSL`, `VCVTSI2SSQ` | -| `ANDN` | `ANDNL`, `ANDNQ` | -| `BEXTR` | `BEXTRL`, `BEXTRQ` | -| `BLSI` | `BLSIL`, `BLSIQ` | -| `BLSMSK` | `BLSMSKL`, `BLSMSKQ` | -| `BLSR` | `BLSRL`, `BLSRQ` | -| `BZHI` | `BZHIL`, `BZHIQ` | -| `MULX` | `MULXL`, `MULXQ` | -| `PDEP` | `PDEPL`, `PDEPQ` | -| `PEXT` | `PEXTL`, `PEXTQ` | -| `RORX` | `RORXL`, `RORXQ` | -| `SARX` | `SARXL`, `SARXQ` | -| `SHLX` | `SHLXL`, `SHLXQ` | -| `SHRX` | `SHRXL`, `SHRXQ` | - -### Encoder details - -Bitwise comparison with older encoder may fail for VEX-encoded instructions due to slightly different encoder tables order. - -This difference may arise for instructions with both `{reg, reg/mem}` and `{reg/mem, reg}` forms for reg-reg case. One of such instructions is `VMOVUPS`. - -This does not affect code behavior, nor makes it bigger/less efficient. -New encoding selection scheme is borrowed from [Intel XED](https://github.com/intelxed/xed). - -EVEX encoding is used when any of the following is true: - -* Instruction uses new registers (High 16 `X`/`Y`, `Z` or `K` registers) -* Instruction uses EVEX-related opcode suffixes like `BCST` -* Instruction uses operands combination that is only available for AVX-512 - -In all other cases VEX encoding is used. -This means that VEX is used whenever possible, and EVEX whenever required. - -Compressed disp8 is applied whenever possible for EVEX-encoded instructions. -This also covers broadcasting disp8 which sometimes has different N multiplier. - -Experienced readers can inspect [avx_optabs.go](https://github.com/golang/go/blob/master/src/cmd/internal/obj/x86/avx_optabs.go) to learn about N multipliers for any instruction. - -For example, `VADDPD` has these: -* `N=64` for 512-bit form; `N=8` when broadcasting -* `N=32` for 256-bit form; `N=8` when broadcasting -* `N=16` for 128-bit form; `N=8` when broadcasting - -### Examples - -Exhaustive amount of examples can be found in Go assembler [test suite](https://github.com/golang/go/tree/master/src/cmd/asm/internal/asm/testdata/avx512enc). - -Each file provides several examples for every supported instruction form in particular AVX-512 extension. -Every example also includes generated machine code. - -Here is adopted "Vectorized Histogram Update Using AVX-512CD" from -[Intel® Optimization Manual](https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-optimization-manual.pdf): - -```go -for i := 0; i < 512; i++ { - histo[key[i]] += 1 -} -``` - -```asm -top: - VMOVUPS 0x40(SP)(DX*4), Z4 //; vmovups zmm4, [rsp+rdx*4+0x40] - VPXORD Z1, Z1, Z1 //; vpxord zmm1, zmm1, zmm1 - KMOVW K1, K2 //; kmovw k2, k1 - VPCONFLICTD Z4, Z2 //; vpconflictd zmm2, zmm4 - VPGATHERDD (AX)(Z4*4), K2, Z1 //; vpgatherdd zmm1{k2}, [rax+zmm4*4] - VPTESTMD histo<>(SB), Z2, K0 //; vptestmd k0, zmm2, [rip+0x185c] - KMOVW K0, CX //; kmovw ecx, k0 - VPADDD Z0, Z1, Z3 //; vpaddd zmm3, zmm1, zmm0 - TESTL CX, CX //; test ecx, ecx - JZ noConflicts //; jz noConflicts - VMOVUPS histo<>(SB), Z1 //; vmovups zmm1, [rip+0x1884] - VPTESTMD histo<>(SB), Z2, K0 //; vptestmd k0, zmm2, [rip+0x18ba] - VPLZCNTD Z2, Z5 //; vplzcntd zmm5, zmm2 - XORB BX, BX //; xor bl, bl - KMOVW K0, CX //; kmovw ecx, k0 - VPSUBD Z5, Z1, Z1 //; vpsubd zmm1, zmm1, zmm5 - VPSUBD Z5, Z1, Z1 //; vpsubd zmm1, zmm1, zmm5 - -resolveConflicts: - VPBROADCASTD CX, Z5 //; vpbroadcastd zmm5, ecx - KMOVW CX, K2 //; kmovw k2, ecx - VPERMD Z3, Z1, K2, Z3 //; vpermd zmm3{k2}, zmm1, zmm3 - VPADDD Z0, Z3, K2, Z3 //; vpaddd zmm3{k2}, zmm3, zmm0 - VPTESTMD Z2, Z5, K2, K0 //; vptestmd k0{k2}, zmm5, zmm2 - KMOVW K0, SI //; kmovw esi, k0 - ANDL SI, CX //; and ecx, esi - JZ noConflicts //; jz noConflicts - ADDB $1, BX //; add bl, 0x1 - CMPB BX, $16 //; cmp bl, 0x10 - JB resolveConflicts //; jb resolveConflicts - -noConflicts: - KMOVW K1, K2 //; kmovw k2, k1 - VPSCATTERDD Z3, K2, (AX)(Z4*4) //; vpscatterdd [rax+zmm4*4]{k2}, zmm3 - ADDL $16, DX //; add edx, 0x10 - CMPL DX, $1024 //; cmp edx, 0x400 - JB top //; jb top -``` \ No newline at end of file diff --git a/Articles.md b/Articles.md index eaf47ebb..ef80919c 100644 --- a/Articles.md +++ b/Articles.md @@ -1,264 +1,4 @@ +The Go wiki on GitHub has moved to go.dev (#61940). -Please keep all entries in reverse chronological order (most recent first) +Try or . -Table of Contents -================= - -* [Indexes](#article-indexes) -* [General](#general) -* [Concurrency / Channels](#concurrency--channels) -* [Containers & Docker](#containers--docker) -* [Cross Platform Development](#cross-platform-development) -* [Error Handling](#error-handling) -* [Interfaces / OOP](#interfaces--oop) -* [Mobile Applications](#mobile-applications) -* [Modules](#modules) -* [Performance and Profiling](#performance-and-profiling) -* [Pointers/References/Memory](#pointers-references-and-memory-management) -* [Reflection](#reflection) -* [Security](#security) -* [Testing](#testing) -* [Web & API Development](#web--api-development) -* [Misc](#misc) -* [Chinese](#chinese) -* [Czech](#czech) -* [German](#german) -* [Japanese](#japanese) -* [Korean](#korean) - -## Article Indexes - - * [Collection of #golang posts on Medium](https://medium.com/tag/golang) _latest_ - * [Go articles from Dr. Dobbs](http://www.drdobbs.com/sitesearch?sort=publishDate+desc&queryText=golang&type=site) _latest_ - * [Slideshare Collection of #golang presentations](http://www.slideshare.net/search/slideshow?searchfrom=header&q=golang&ud=any&ft=all&lang=**&sort=) _latest_ - * [Short Go tutorials on SocketLoop](https://www.socketloop.com/tagsearch/golang) _latest_ - * [An Introduction to Go](https://tutorialedge.net/course/golang/) _latest_ - -## General - - * [Darker Corners of Go](https://rytisbiel.com/2021/03/06/darker-corners-of-go/) _2021-03-13_ - * [Working with Golang Maps](https://www.loginradius.com/engineering/blog/working-with-go-maps/) _2020-09-25_ - * [Practical Go: Real world advice for writing maintainable Go programs](https://dave.cheney.net/practical-go/presentations/gophercon-singapore-2019.html) _2019-05-01_ - * [Here are some amazing advantages of Go that you don’t hear much about](https://www.freecodecamp.org/news/here-are-some-amazing-advantages-of-go-that-you-dont-hear-much-about-1af99de3b23a/) _2018-02-01_ - * [Go Defer Simplified with Practical Visuals](https://blog.learngoprogramming.com/golang-defer-simplified-77d3b2b817ff) _2017-11-23_ - * [The Zoo of Go Funcs](https://blog.learngoprogramming.com/go-functions-overview-anonymous-closures-higher-order-deferred-concurrent-6799008dde7b) _2017-11-09_ - * [Ultimate Guide to Go Variadic Functions](https://blog.learngoprogramming.com/golang-variadic-funcs-how-to-patterns-369408f19085) _2017-11-02_ - * [Go Funcs-Baby Gopher's Visual Guide](https://blog.learngoprogramming.com/golang-funcs-params-named-result-values-types-pass-by-value-67f4374d9c0a) _2017-10-27_ - * [Ultimate Visual Guide to Go Enums](https://blog.learngoprogramming.com/golang-const-type-enums-iota-bc4befd096d3) _2017-10-19_ - * [Learn Go Constants](https://blog.learngoprogramming.com/learn-golang-typed-untyped-constants-70b4df443b61) _2017-10-10_ - * [Learn Go Variables](https://blog.learngoprogramming.com/learn-go-lang-variables-visual-tutorial-and-ebook-9a061d29babe) _2017-10-04_ - * [Introduction to Go Packages](https://blog.learngoprogramming.com/definitive-guide-to-go-packages-focus-on-the-fundamentals-to-empower-your-skills-d14aae7cd321) _2017-09-26_ - * [About Go Language — An Overview](https://blog.learngoprogramming.com/about-go-language-an-overview-f0bee143597c) _2017-09-20_ - * [Debugging code generation in Go](https://rakyll.org/codegen/) _2016-10-15_ - * [Go tooling essentials](https://rakyll.org/go-tool-flags/) _2016-09-25_ - * [Go from PHP engineer's perspective](http://sobit.me/2016/02/25/go-from-php-engineers-perspective/) _2016-02-25_ - * [Go Proverbs, Illustrated](http://www.gregosuri.com/2015/12/04/go-proverbs-illustrated/) _2015-12-04_ - * [A whirlwind tour of Go’s runtime environment variables](http://dave.cheney.net/2015/11/29/a-whirlwind-tour-of-gos-runtime-environment-variables) _2015-11-29_ - * [Idiomatic Doc Comments: Document your function, not your function signature](http://whipperstacker.com/2015/10/14/idiomatic-doc-comments-document-your-function-not-your-function-signature/) _2015-10_14_ - * [Best Practices for a new Go Developer](https://medium.com/@IndianGuru/best-practices-for-a-new-go-developer-8660384302fc) _2015-09-01_ - * [Golang Refactoring Tools](http://blog.ralch.com/tutorial/golang-tools-refactoring/) _2015-08-30_ - * [Working with Files in Go](http://www.devdungeon.com/content/working-files-go) _2015-08-23_ - * [Defer Fun](https://blog.klauspost.com/defer-fun/) _2015-07-25_ - * [Things I learned teaching Go - Francesc Campoy](https://medium.com/@francesc/dotgo-things-i-learned-teaching-go-e999f33298cf) _2014-11-24_ - * [Understanding Go Packages](http://thenewstack.io/understanding-golang-packages/) _2014-11-01_ - * [Structuring Applications in Go](https://medium.com/@benbjohnson/structuring-applications-in-go-3b04be4ff091#.kj6eym1u4) _2014-06-06_ - * [Functional Options for Friendly APIs](http://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis) _2014-10-17_ - * [Go Programming for Beginners](http://thenewstack.io/the-new-stack-intros-go-programming-for-beginners/) _2014-10-01_ - * [Switching from Python to Go](https://www.spacemonkey.com/blog/posts/go-space-monkey) _2014-04-21_ - * [Google Go: The Good, the Bad, and the Meh](http://blog.carlsensei.com/post/42828735125) _2013-02-10_ - * [What I Love About Go](http://npf.io/2013/01/what-i-love-about-go) _2013-01-25_ - * [Why I program in Go](http://tech.t9i.in/2013/01/why-program-in-go/) _2013-01-05_ - * [Go: A New Language for a New Year](http://kylelemons.net/2012/01/go-new-language-new-year/) _2012-01-06_ - * [Why you PHP guys should learn Golang](http://www.mikespook.com/2012/08/why-you-php-guys-should-learn-golang/) _2012-08-10_ - * [Why I went from Python to Go (and not node.js)](http://jordanorelli.tumblr.com/post/31533769172/why-i-went-from-python-to-go-and-not-node-js) _2012-09-14_ - * [How and Why to Write Enums in Go](https://blog.boot.dev/golang/golang-enum/) _2021-04-19_ - -## Concurrency / Channels - - * [Learning Go concurrency through illustrations](https://medium.com/@trevor4e/learning-gos-concurrency-through-illustrations-8c4aff603b3) _2018-06-21_ - * [Using contexts to avoid leaking goroutines](https://rakyll.org/leakingctx/) _2016-10-25_ - * [Concurrency in Go](http://www.minaandrawos.com/2015/12/06/concurrency-in-golang/) _2015-12-06_ - * [Very basic concurrency for beginners in Go](https://medium.com/@matryer/very-basic-concurrency-for-beginners-in-go-663e63c6ba07#.n831uhdiq) _2015-11-18_ - * [Exploting Powerful Cloud Services with Go](https://medium.com/@sathishvj/exploiting-your-powerful-cloud-servers-with-go-lang-s-concurrency-eae5f4c7526) _2015-10-11_ - * [Golang lock-free values with atomic.Value](https://texlution.com/post/golang-lock-free-values-with-atomic-value/) _2015-08-21_ - * [Golang Pearl: Thread-safe writes and double checked locking in Go](http://blog.launchdarkly.com/golang-pearl-thread-safe-writes-and-double-checked-locking-in-go/) _2015-07-21_ - * [Golang: Funny Play with Channel](http://www.mikespook.com/2012/05/golang-funny-play-with-channel/) _2012-05-25_ - * [Unlimited Buffering with Low Overhead](http://rogpeppe.wordpress.com/2010/02/10/unlimited-buffering-with-low-overhead/) _2010-02-10_ - * [Concurrent Idioms #1: Broadcasting values in Go with linked channels](http://rogpeppe.wordpress.com/2009/12/01/concurrent-idioms-1-broadcasting-values-in-go-with-linked-channels/) _2009-12-01_ - -## Containers & Docker - - * [Deploying a Go app to a minimal Docker container](http://www.giantflyingsaucer.com/blog/?p=5720) _2015-10-01_ - * [Fetching a remote configuration using Docker and Consul](http://www.giantflyingsaucer.com/blog/?p=5701) _2015-09-30_ - * [Joining the Docker Ship and Go](http://thenewstack.io/make-a-restful-json-api-go/) _2015-07-01_ - * [Building Minimal Docker Images for Go](http://blog.codeship.com/building-minimal-docker-containers-for-go-applications/) _2015-04-23_ - -## Cross-Platform Development - * [Releasing cross-platform Go binaries using Goxc and BinTray in 5 minutes](http://jbu.io/2015/11/29/releasing-cross-platform-go-binaries-using-goxc-and-bintray-in-5-minutes/) _2015-11-29_ - * [Calling Go from Swift](https://rakyll.org/swift/) _2015-10-3_ - * [On Go, portability, and system interfaces](http://garrett.damore.org/2015/09/on-go-portability-and-system-interfaces.html) _2015-09-22_ - * [Go cross compilation](https://rakyll.org/cross-compilation/) _2015-09-8_ - -## Error Handling - - * [Returning Errors](https://npf.io/2015/10/errors/) _2015-10-10_ - * [Inspecting Errors](http://dave.cheney.net/2014/12/24/inspecting-errors) _2014-12-24_ - -## Interfaces / OOP - - * [Generics in Golang with Code Generation](http://blog.ralch.com/tutorial/golang-code-generation-and-generics/) _2015-10-18_ - * [Composition with Go](http://www.goinggo.net/2015/09/composition-with-go.html) _2015-09-13_ - * [Sorting Inventory Items in Go - the sort.Interface](https://adampresley.github.io/2015/09/06/sorting-inventory-items-in-go.html) _2015-09-06_ - * [Loose Coupling in Go Lang](https://blog.8thlight.com/javier-saldana/2015/02/06/loose-coupling-in-go-lang.html) _2015-02-06_ - * [How to use interfaces in Go](http://jordanorelli.tumblr.com/post/32665860244/how-to-use-interfaces-in-go) _2012-10-01_ - * [Go Object Oriented Design](http://nathany.com/good) _2013-01-14_ - * [It is ridiculously easy to refactor Go](http://www.onebigfluke.com/2013/01/it-is-ridiculously-easy-to-refactor-go.html) _2013-01-27_ - * [Functional Iteration in Go](http://hackthology.com/functional-iteration-in-go.html) _2013-12-13_ - * [Interfaces in Go - Russ Cox](http://research.swtch.com/interfaces) _2009-12-01_ - - -## Mobile Applications - -Start by reading the [overview of mobile development](Mobile) documentation first. - - * [Go Mobile: Next generation of mobile apps](https://www.linkedin.com/pulse/go-mobile-next-generation-apps-daniele-baroncelli) _2015-09-18_ - * [iOS Apps with Go - Video by Josh Deprez](https://www.youtube.com/watch?v=bftMhhMIJNo) _2015-09-17_ - * [5 Part Series - Mobile Go](https://medium.com/using-go-in-mobile-apps) _2015-01-08_ - -## Modules - - * [Introduction to Go Modules](https://roberto.selbach.ca/intro-to-go-modules/) _2018-08-18_ - -## Performance and Profiling - - * [Mutex profile](https://rakyll.org/mutexprofile/) _2016-12-19_ - * [How to Optimize Garbage Collection in Go](http://www.cockroachlabs.com/blog/how-to-optimize-garbage-collection-in-go/) _2015-11-23_ - * [Golang Escape Analysis](http://www.agardner.me/golang/garbage/collection/gc/escape/analysis/2015/10/18/go-escape-analysis.html) _2015-10-18_ - * [A Pattern for Optimizing Go](http://blog.signalfx.com/a-pattern-for-optimizing-go) _2015-09-24_ - * [Golang Performance Tips](https://joshrendek.com/2015/09/golang-performance-tips/) _2015-09-20_ - * [Answering your own (performance) questions in Go](http://www.sanarias.com/blog/915LearningtoansweryourownquestionsinGo) _2015-09-15_ - * [Concise Guide to profiling go programs](https://medium.com/@tjholowaychuk/profiling-golang-851db2d9ae24) _2014-08-09_ - * [Go Performance Observations](http://hashrocket.com/blog/posts/go-performance-observations) _2014-08-07_ - * [Debugging performance issues in Go programs - Intel](https://software.intel.com/en-us/blogs/2014/05/10/debugging-performance-issues-in-go-programs) _2014-05-10_ - * [How to write benchmarks in Go](http://dave.cheney.net/2013/06/30/how-to-write-benchmarks-in-go) _2013-06-30_ - * [Profiling Go Programs - Go blog](https://go.dev/blog/profiling-go-programs) _2011-06-24_ - -## Pointers, References and Memory Management - - * [Equality and Type Aliases](https://akutz.wordpress.com/2015/09/02/golang-equality-and-type-aliases/) _2015-09-02_ - * [Pointers vs References](http://spf13.com/post/go-pointers-vs-references/) _2014-06-01_ - * [Recycling Memory Buffers in Go](https://blog.cloudflare.com/recycling-memory-buffers-in-go/) _2013-08-24_ - * [Learning Go Types](http://www.laktek.com/2012/01/27/learning-go-types/) _2012-01-27_ - * [Saving a Third of Our Memory by Re-ordering Go Struct Fields](https://wagslane.dev/posts/go-struct-ordering/) _2020-08-07_ - -## Reflection - - * [Go Reflection Index](https://jimmyfrasche.github.io/go-reflection-codex/) by Jimmy Frasche _2014-01-26_ - -## Security - - * [Mutual TLS authentication in Go](http://www.levigross.com/2015/11/21/mutual-tls-authentication-in-go/) _2015-11-21_ - * [Whispered Secrets - The case for building software with privacy as a primary concern](http://www.slideshare.net/feyeleanor/whispered-secrets-52966860) _2015-09-19_ - -## Testing - - * [Getting Started with BDD in Go Using Ginkgo](https://semaphoreci.com/community/tutorials/getting-started-with-bdd-in-go-using-ginkgo) _2016-07-12_ - * [Integration testing in Go using Docker](https://divan.github.io/posts/integration_testing/) _2015-12-07_ - * [Debugging Go Programs with Delve](https://blog.gopheracademy.com/advent-2015/debugging-with-delve/) _2015-12-03_ - * [Upgrade Your Appengine Tests with Testify](http://csfortheslothful.blogspot.com/2015/11/upgrade-your-appengine-tests-with.html) _2015_11_21_ - -## Web & API Development - -Start by reading the [overview of server programming](LearnServerProgramming) documentation first. - * [Get started with Go and WebAssembly](https://medium.com/@sendilkumarn/getting-started-into-go-and-webassembly-8491b133a616) _2018-08-14_ - * [HTTP/2 Server Push](https://rakyll.org/http2push/) _2016-12-10_ - * [Preventing Cross-Site Request Forgery in Go](https://elithrar.github.io/article/preventing-csrf-attacks-in-go/) _2015-12-14_ - * [goa: Untangling Microservices](https://blog.gopheracademy.com/advent-2015/goaUntanglingMicroservices/) _2015-12-07_ - * [A Weekend with Go, Beego and React](http://foreman-shlomizadok.rhcloud.com/2015/11/03/a-weekend-with-go-lang-beego-react/) _2015-11-03_ - * [HTTP Session Handling on Heroku](https://devcenter.heroku.com/articles/go-sessions) _2015-09-09_ - * [Go Resiliency Patterns](https://github.com/eapache/go-resiliency) _2015-09-01_ - * [http.Handler and Error Handling in Go](https://elithrar.github.io/article/http-handler-error-handling-revisited/) _2015-07-02_ - * [Deploy a golang photo archive tool to the cloud on IBM BlueMix](http://www.ibm.com/developerworks/cloud/library/cl-golang-photo-archive-bluemix/index.html) _2015-06-05_ - * [A Journey into Microservices - Part 1](https://sudo.hailoapp.com/services/2015/03/09/journey-into-a-microservice-world-part-1/), [Part 2](https://sudo.hailoapp.com/services/2015/03/09/journey-into-a-microservice-world-part-2/), [Part 3](https://sudo.hailoapp.com/services/2015/03/09/journey-into-a-microservice-world-part-3/) _2015-03_09_ - * [Making a RESTful JSON API in Go](http://thenewstack.io/make-a-restful-json-api-go/) _2015-01-01_ - * [Building a Web Server in Go](http://thenewstack.io/building-a-web-server-in-go/) _2014-09-01_ - * [The Ultimate Guide to JSON in Go](https://blog.boot.dev/golang/json-golang/) _2021-04-28_ - - -## Misc - - * [Environment variables in Golang](https://www.loginradius.com/engineering/blog/environment-variables-in-golang/) _2020-09-28_ - * [Using MongoDB as Datasource in GoLang](https://www.loginradius.com/blog/engineering/mongodb-as-datasource-in-golang/) _2020-09-21_ - * [Go-powered Open Source IoT Integration Framework "Flogo"](http://www.kai-waehner.de/blog/2016/11/03/open-source-project-flogo-overview/) _2016-11-07_ - * [Build Slack Slash Commands with Go](http://www.programmableweb.com/news/how-to-use-slack-api-to-build-slash-commands-powered-google-app-engine-and-go/how-to/2015/09/16) _2015-09-15_ - * [String Matching by Damian Gryski](http://blog.gopheracademy.com/advent-2014/string-matching/) _2014-12-05_ - * [State machines in Go (#golang)](http://denis.papathanasiou.org/?p=1190) _2013-02-10_ - * [Go & Assembly](http://www.doxsey.net/blog/go-and-assembly) _2013-02-05_ - * [Function Types in Go (golang)](http://jordanorelli.tumblr.com/post/42369331748/function-types-in-go-golang) _2013-02-05_ - * [Optimizing Real World Go](http://bpowers.github.com/weblog/2013/01/05/optimizing-real-world-go/) _2013-01-05_ - * [Methods as Objects in Go](http://ernestmicklei.com/2012/11/26/methods-as-objects-in-go/) _2012-12-26_ - * [Applying The Clean Architecture to Go applications](http://manuel.kiessling.net/2012/09/28/applying-the-clean-architecture-to-go-applications/) _2012-09-08_ - * [An introduction to cross compilation with Go](http://dave.cheney.net/2012/09/08/an-introduction-to-cross-compilation-with-go) _2012-09-08_ - * [Function Call by Name in Golang](http://www.mikespook.com/2012/07/function-call-by-name-in-golang/) _2012-07-05_ - * [Using the Go Regexp Package](http://blog.kamilkisiel.net/blog/2012/07/05/using-the-go-regexp-package/) _2012-07-05_ - * [Zero Downtime upgrades of TCP servers in Go](http://blog.nella.org/?p=879) _2012-05-29_ - * [Go Reflection Codex](http://jimmyfrasche.github.io/go-reflection-codex/) - * [Go JSON Marshalling and Unmarshalling cheatsheet](https://eager.io/blog/go-and-json/) _2015-09-30_ - - - -## Chinese - - * [Test Go module](http://chenxiaoyu.org/2012/12/07/golang-module-test-benchmark.html) - * [Build web application with golang](https://github.com/astaxie/build-web-application-with-golang) - * [Go语言评估报告](https://docs.google.com/document/d/1NosYIbM6tfBqKh49BrHOngBfXuT1MfrvYXwc_ikwuMk/edit) - * [Why you PHP guys should learn Golang](http://www.mikespook.com/2012/08/%e4%b8%ba%e4%bb%80%e4%b9%88phper%e5%ba%94%e5%bd%93%e5%ad%a6%e4%b9%a0golang/) - * [Function Call by Name in Golang](http://www.mikespook.com/2012/07/%e5%9c%a8-golang-%e4%b8%ad%e7%94%a8%e5%90%8d%e5%ad%97%e8%b0%83%e7%94%a8%e5%87%bd%e6%95%b0/) - * [Golang: Funny Play with Channel](http://www.mikespook.com/2012/06/golang-channel-%e6%9c%89%e8%b6%a3%e7%9a%84%e5%ba%94%e7%94%a8/) - * [Using MyMySQL - A interface of database/sql](http://www.mikespook.com/2012/05/mymysql-%e7%9a%84-databasesql-%e6%8e%a5%e5%8f%a3%e4%bd%bf%e7%94%a8/) - * [Go did What on the Stack?](http://www.mikespook.com/2011/03/go%e5%9c%a8stack%e4%b8%8a%e5%b9%b2%e4%ba%86%e7%a5%9e%e9%a9%ac%ef%bc%9f/) - * [Gobs on the wire (Translation)](http://www.mikespook.com/2011/03/%e7%bf%bb%e8%af%91%e9%a3%9e%e7%bf%94%e7%9a%84-gob/) - * [Go Environment Setup (Translation)](http://www.mikespook.com/2012/02/%E7%BF%BB%E8%AF%91go-%E7%8E%AF%E5%A2%83%E8%AE%BE%E7%BD%AE/) - * [Error Handling and Go (Translation)](http://www.mikespook.com/2011/08/%E9%94%99%E8%AF%AF%E5%A4%84%E7%90%86%E5%92%8Cgo/) - * [The Go Tool (Translation)](http://www.mikespook.com/2012/02/%E7%BF%BB%E8%AF%91go-%E5%B7%A5%E5%85%B7/) - * [Less is exponentially more (Translation)](http://www.mikespook.com/2012/06/%E7%BF%BB%E8%AF%91%E5%B0%91%E6%98%AF%E6%8C%87%E6%95%B0%E7%BA%A7%E7%9A%84%E5%A4%9A/) - * [Zero Downtime upgrades of TCP servers in Go (Translation)](http://www.mikespook.com/2012/05/%E7%BF%BB%E8%AF%91%E7%94%A8-go-%E5%AE%9E%E7%8E%B0%E9%9B%B6%E5%81%9C%E6%9C%BA%E5%8D%87%E7%BA%A7-tcp-%E6%9C%8D%E5%8A%A1/) - * [Using Go Modules (Translation)](https://www.4async.com/2019/03/2019-03-20-using-go-modules/) - -## Czech - - * [Google Go - 1st birthday](http://www.abclinuxu.cz/clanky/google-go-1.-narozeniny) - * [Google Go - what we find in the kit](http://www.abclinuxu.cz/clanky/google-go-co-najdeme-ve-stavebnici) - * [Google Go - advanced topics](http://www.abclinuxu.cz/clanky/google-go-pokrocilejsi-temata) - * [Google Go by examples I.](http://www.abclinuxu.cz/clanky/google-go-v-prikladech-1) - * [Google Go by examples II.](http://www.abclinuxu.cz/clanky/google-go-v-prikladech-2) - * [Error handling in Go](http://www.abclinuxu.cz/clanky/osetrovani-chyb-v-go) - * [Google Go - The Laws of Reflection](http://www.abclinuxu.cz/clanky/google-go-pravidla-reflexe) - * [Google Go - 2nd birthday](http://www.abclinuxu.cz/clanky/google-go-2.-narozeniny) - -## German - - * [Programmiersprachen im Multicore Zeitalter - Google GO und Nebenläufigkeit](http://ps.informatik.uni-siegen.de/downloads/Seminare/multicore-ws2011/donner.pdf) ` [PDF] ` _2012-02-02_ - -## Japanese - - * [WindowsでGo言語のまとめ](http://esten.wankuma.com/) - * [Go言語で jQuery ライクな操作が出来る goquery を試した。](http://mattn.kaoriya.net/software/lang/go/20120914184828.htm) - * [Go言語向けの ORM、gorp がなかなか良い](http://mattn.kaoriya.net/software/lang/go/20120914222828.htm) - * [GAE/GでGoogle Cloud Storageを利用するには(1)](http://takashi-yokoyama.blogspot.jp/2012/08/gaeggoogle-cloud-storage.html) - * [Go言語のWebフレームワーク"goweb"をGAE/Gで動かす](http://takashi-yokoyama.blogspot.jp/2012/07/gowebgowebgaeg.html) - * [Ubuntu 12.04にgolangを”ソースから”インストールする。](http://takashi-yokoyama.blogspot.jp/2012/07/ubuntu-1204golang.html) - * [GAE/Gで時間のチェック(Datastore編)](http://takashi-yokoyama.blogspot.jp/2012/06/gaegdatastore.html) - -## Korean - - * [The Go Programming Language](http://www.slideshare.net/golanger/abou-go) - * [You can read Go code](http://goo.gl/vUeSzl) - * [Go channel tutorial](http://blog.sabzil.org/2014/12/golang-channels-tutorial) - * [Go character encoding](http://www.slideshare.net/suapapa/go-character-encoding) - * [Using Google API in Go](http://www.slideshare.net/golanger/using-google-api-in-go) - * [Go로 Git 들여다보기](http://goo.gl/nCDV3I) - * [Go: 90% 완벽?!, 100% of the time 슬라이드 번역 ](http://100coding.com/go/slide) - * [Go 동시성 패턴 advanced 영상 번역](http://www.youtube.com/watch?v=4g2skln42eo) - * [Go + Revel + Gorp 간단 게시판 만들기](http://100coding.com/go/tutorial/1) - * [Go + Revel + Gorm 으로 만드는 블로그](https://github.com/jaehue/goblog/wiki/Hello-World) \ No newline at end of file diff --git a/AssemblyPolicy.md b/AssemblyPolicy.md index a8841e7d..02370081 100644 --- a/AssemblyPolicy.md +++ b/AssemblyPolicy.md @@ -1,15 +1,4 @@ -This document describes when and how to add assembly code to the Go cryptography packages. +The Go wiki on GitHub has moved to go.dev (#61940). -In general, the rules are: +Try or . -* We prefer portable Go, not assembly. Code in assembly means (N packages * M architectures) to maintain, rather than just N packages. -* Minimize use of assembly. We'd rather have a small amount of assembly for a 50% speedup rather than twice as much assembly for a 55% speedup. Explain the decision to place the assembly/Go boundary where it is in the commit message, and support it with benchmarks. -* Use higher level programs to generate non-trivial amounts of assembly, either standalone Go programs or `go get`-able programs, like [avo](https://github.com/mmcloughlin/avo). Output of other reproducible processes (like formally verified code generators) will also be considered. Discuss the implementation strategy on the issue tracker in advance. -* Use small, testable units (25–75 lines) called from higher-level logic written in Go. If using small, testable functions called from logic written in Go is too slow, use small, testable assembly units with Go-compatible wrappers, so that Go tests can still test the individual units. -* Any assembly function needs a reference Go implementation, that’s tested side-by-side with the assembly. Follow [golang.org/wiki/TargetSpecific](https://go.dev/wiki/TargetSpecific) for structure and testing practices. -* The interface of the assembly units and of the reference Go implementation must be the same across architectures, unless the platforms have fundamentally different capabilities (such as high-level cryptographic instructions). -* Unless the Go Security team explicitly commits to owning the specific implementation, an external contributor must commit to maintaining it. If changes are required (for example as part of a broader refactor) and the maintainer is not available, the assembly will be removed. -* The code must be tested in our CI. This means there need to be builders that support the instructions, and if there are multiple (or fallback) paths they must be tested separately. (Tip: use `GODEBUG=cpu.X=off` to disable detection of CPU features.) -* Document in the Go code why the implementation requires assembly (specific performance benefit, access to instructions, etc), so we can reevaluate as the compiler improves. - -Not all assembly currently in the standard library adheres to this policy. Changes to existing assembly will be discouraged until that implementation is updated to be compliant. New assembly must be compliant. \ No newline at end of file diff --git a/Benchmarks.md b/Benchmarks.md index 23c593cd..066b0179 100644 --- a/Benchmarks.md +++ b/Benchmarks.md @@ -1,67 +1,4 @@ -These are benchmarks collected from the community used to measure the effects of changes to the Go core (compiler, runtime, garbage collector, and libraries). They should have the following properties: +The Go wiki on GitHub has moved to go.dev (#61940). - - they matter; someone cares, perhaps in a dollars-and-cents way, that they run well - - they are go-gettable and don't require customized steps for building the benchmark - - they run under `go test -bench ...` - - they run relatively quickly, ideally a single "run" takes less than a second (there should perhaps be a separate set of longer-running benchmarks) - - their timings are not gratuitously noisy - - they run cleanly in a restricted environment, such as a Docker or rkt container - - they're not gratuitously redundant with other benchmarks already in the list; we don't need ten microbenchmarks of Go transcendental functions +Try or . -**These benchmarks change over time, and that is okay.** Their intended use is for performance testing of proposed changes; is the geometric mean better, were any benchmarks made substantially worse? - -Information for each benchmark includes (or should include): - - - a short name for the benchmark - - the path to `go get` the benchmark - - a regexp for the benchmark suite excluding individual benchmarks that might be noisy, long-running, or redundant - - (ideally) a contact person for questions about the benchmarks - - | short name | notes | go get path | benchmark regexp | contact | - | ---------- | ----- | ----------- | ---------------- | ------- | - | ajstarks_deck_generate | | `github.com/ajstarks/deck/generate` | `Benchmark(Polygon\|Arc)` | | - | benhoyt_goawk | | `github.com/benhoyt/goawk/interp` | `BenchmarkR` | | - | bindata | | `github.com/kevinburke/go-bindata` | `Benchmark` | | - | capnproto2 | | `zombiezen.com/go/capnproto2/` | `Benchmark(TextMovementBetweenSegments\|Growth_MultiSegment)` | | - | cespare_mph | | `github.com/cespare/mph` | `BenchmarkBuild` | | - | cespare_xxhash | | `github.com/cespare/xxhash` | `BenchmarkHashes/xxhash-string,n=10_MB` | | - | ericlagergren_decimal | | `github.com/ericlagergren/decimal/benchmarks` | `BenchmarkPi_decimal_Go_9` | | - | ethereum_bitutil | | `github.com/ethereum/go-ethereum/common/bitutil` | `Benchmark(BaseTest2KB\|FastTest2KB\|Encoding4KBVerySparse)` | | - | ethereum_core | | `github.com/ethereum/go-ethereum/core` | `BenchmarkChainRead_full_10k` | | - | ethereum_corevm | | `github.com/ethereum/go-ethereum/core/vm` | `BenchmarkOpDiv128` | | - | ethereum_ecies | | `github.com/ethereum/go-ethereum/crypto/ecies` | `BenchmarkGenSharedKeyP256` | | - | ethereum_ethash | | `github.com/ethereum/go-ethereum/consensus/ethash` | `BenchmarkHashimotoLight` | | - | ethereum_sha3 | | `github.com/ethereum/go-ethereum/crypto/sha3` | `BenchmarkSha3_224_MTU` | | - | ethereum_storage | | `github.com/ethereum/go-ethereum/swarm/storage` | `BenchmarkJoin_8` | | - | ethereum_trie | | `github.com/ethereum/go-ethereum/trie` | `Benchmark` | | - | gonum_blas_native | | `gonum.org/v1/gonum/blas/gonum` | `Benchmark(DasumMediumUnitaryInc\|Dnrm2MediumPosInc)` | | - | gonum_community | | `gonum.org/v1/gonum/graph/community/` | `BenchmarkLouvainDirectedMultiplex` | | - | gonum_lapack_native | | `gonum.org/v1/gonum/lapack/gonum` | `BenchmarkDgeev/Circulant10` | | - | gonum_mat | | `gonum.org/v1/gonum/mat` | `Benchmark(MulWorkspaceDense1000Hundredth\|ScaleVec10000Inc20)` | | - | gonum_path | | `gonum.org/v1/gonum/graph/path/` | `Benchmark(AStarUndirectedmallWorld_10_2_2_2_Heur\|Dominators/nested_if_n256)` | | - | gonum_topo | | `gonum.org/v1/gonum/graph/topo/` | `Benchmark(TarjanSCCGnp_1000_half\|TarjanSCCGnp_10_tenth)` | | - | gonum_traverse | | `gonum.org/v1/gonum/graph/traverse/` | `BenchmarkWalkAllBreadthFirstGnp_(10\|1000)_tenth` | | - | gtank_blake2s | | `github.com/gtank/blake2s` | `BenchmarkHash8K` | | - | gtank_ed25519 | | `github.com/gtank/ed25519` | `Benchmark(IsOnCurve\|ScalarMult)` | | - | hugo_helpers | | `github.com/gohugoio/hugo/helpers` | `Benchmark(StripHTML\|ReaderContains)` | | - | hugo_hugolib | | `github.com/gohugoio/hugo/hugolib` | `BenchmarkParsePage` | | - | hugo_hugolib_sitebuilding | | `github.com/gohugoio/hugo/hugolib` | `BenchmarkSiteBuilding/YAML,num_pages=10,num_tags=10,tags_per_page=20,shortcodes,render-12` | | - | k8s_api | | `k8s.io/kubernetes/pkg/api/testing` | `BenchmarkEncodeCodecFromInternalProtobuf` | | - | k8s_schedulercache | | `k8s.io/kubernetes/pkg/scheduler/cache` | `BenchmarkList1kNodes30kPods` | | - | minio | | `github.com/minio/minio/cmd` | `BenchmarkGetObject5MbFS` | | - | nelsam_gxui_interval | | `github.com/nelsam/gxui/interval` | `Benchmark` | | - | pilosa_bitmaps | benchmarks in `roaring/` subdirectory | `github.com/pilosa/pilosa` | `BenchmarkBitmap_IntersectionCount` | jaffee@pilosa.com | - | semver | | `github.com/Masterminds/semver` | `BenchmarkValidateVersionTildeFail` | | - | spexs2 | | `github.com/egonelbre/spexs2/_benchmark/` | `BenchmarkRun/10k/1` | | - | uber_zap | | `go.uber.org/zap/benchmarks` | `BenchmarkAddingFields/(Zap.Sugar\|^[ais])` | | - | uuid | | `github.com/satori/go.uuid/` | `Benchmark(NewV5\|MarshalToString)` | | - -There is a [benchmark runner](https://github.com/dr2chase/bent) that automates downloading, building, and running these benchmarks under various (user-defined) configurations. Benchmarking noise on Linux can be somewhat reduced with [perflock](https://github.com/aclements/perflock). - -A few have been proposed but have so far failed to make the cut (for fetch, build, or noise problems): - - | short name | notes | go get path | benchmark regexp | contact | - | ---------- | ----- | ----------- | ---------------- | ------- | - | eolian_dsp | | `buddin.us/eolian/dsp` | `Benchmark` | | - | ethereum_whisperv5 | | `github.com/ethereum/go-ethereum/whisper/whisperv5` | `Benchmark` | | - | kanzi | | `github.com/flanglet/kanzi/go/src/kanzi/benchmark` | `Benchmark` | | diff --git a/Blogs.md b/Blogs.md index e8d35c78..ee9de9f8 100644 --- a/Blogs.md +++ b/Blogs.md @@ -1,86 +1,4 @@ -A set of blogs dedicated to Go. +The Go wiki on GitHub has moved to go.dev (#61940). -NOTE: Please don't add individual blog entries to this page. Those belong in [articles](Articles) instead. +Try or . -## Arabic - -* [لغة غو بالعربي](https://argolang.com) - موقع عربي مخصص للغة البرمجة غو - -## English - -* [The official Go Blog](https://go.dev/blog) - For in depth posts by the Go team -* [Gopher Academy Blog](http://blog.gopheracademy.com/) -* [Dave Cheney's Blog](http://dave.cheney.net) - * [Dave Cheney's Resources for Go Programmers](http://dave.cheney.net/resources-for-new-go-programmers) -* [spf13's Blog](http://spf13.com/post/) -* [Mat Ryer's Medium Blog](https://medium.com/@matryer) -* [Matt Aimonetti's Blog](http://matt.aimonetti.net/) -* [Marcio.io](http://marcio.io/) -* [Carlos Becker's Blog](http://carlosbecker.com/) -* [Ardan Labs](https://www.ardanlabs.com/blog/) -* [The Golang Weekly](http://golangweekly.com/) -* [Alex Edward's Go Posts](http://www.alexedwards.net/blog/category/golang) -* [GoLang Tutorials](http://golangtutorials.blogspot.com/) -* [Mathias Lafeldt's Blog](https://mlafeldt.github.io/) -* [Marcelo Magallon's Blog](http://blog.ksub.org/bytes/) -* [Mina Andrawos's Go Posts](http://www.minaandrawos.com/category/golang-2/) -* [Aliaksandr Pliutau's Blog](http://pliutau.com/) -* [Johan Brandhorst's Blog](https://jbrandhorst.com) -* [Christoph Berger's Applied Go Blog](https://appliedgo.net) -* [Jon Calhoun's Blog](https://www.calhoun.io/) -* [Inanc Gumus's Learn Go Programming Blog](https://blog.learngoprogramming.com) -* [Elliot Forbes - TutorialEdge.net Go Tutorials](https://tutorialedge.net/course/golang/) -* [Timo Savola's Go Posts](http://savo.la/go) -* [Packt Hub](https://hub.packtpub.com/) -* [GoCenter Community Blog](https://jfrog.com/resource-center/?src=gocenter) - Blogs from GoCenter.io about Go modules and community. -* [Golang on the Boot.dev Blog](https://blog.boot.dev/golang/) -* [Golang Tutorials ](https://www.w3basic.com/golang/) - Golang Tutorials and Blog -* [Go articles at golang.dk](https://www.golang.dk/articles) -* [Bitfield Consulting](https://bitfieldconsulting.com/golang) -* [Mahmud Ridwan's Go Posts](https://hjr265.me/tags/go/) - -## Bahasa Indonesia - -* [Go blog dalam Bahasa Indonesia](https://golang-id.org/blog) - -## Portuguese - -* [Eduardo Nunes Pereira](https://medium.com/@eduardonunespereira) -* [Gopher Brasil](http://gopher.net.br) -* [Bruno Gomes's Blog](https://dev.to/bgskurono) - -## Chinese - -* [无忌-Jincheng's Blog](https://jincheng9.github.io/) -* [Howtoing运维教程](https://www.howtoing.com) -* [虞双齐的博客-Golang](https://yushuangqi.com/tags/golang.html) -* [Tony Bai -- 一个程序员的心路历程](http://tonybai.com/) -* [Arthur 的博客](http://www.zenlife.tk/index) -* [鸟窝](http://colobu.com/) -* [飞雪无情的博客](http://www.flysnow.org) -* [午夜咖啡](http://jolestar.com/) -* [蝈蝈俊的技术心得](http://www.cnblogs.com/ghj1976/) -* [FuXiaohei.Me -- 傅小黑的自留地](http://fuxiaohei.me/) -* [无闻的小站](https://github.com/Unknwon/wuwen.org) -* [astaxie](https://my.oschina.net/astaxie) -* [风笑痴](http://lunny.info/) -* [ipfans's Blog](https://www.4async.com/) -* [Cyeam -- 你不要用战术的勤奋掩盖战略的懒惰。](http://blog.cyeam.com/) -* [战魂小筑](http://www.cppblog.com/sunicdavy) -* [My Candy](http://mengqi.info/) -* [fatedier blog](http://blog.fatedier.com) -* [siddontang 的专栏-my thought for program。](http://blog.csdn.net/siddontang) -* [domac 博客 life should be func](http://lihaoquan.me) -* [七牛云 - 七牛团队博客](http://blog.qiniu.com/) -* [博客 - PingCAP](https://pingcap.com/bloglist) -* [LittleFeng 的博客 -- Python、Golang、Java、后端技术](https://allenwind.github.io) -* [Legendtkl](http://legendtkl.com/) -* [行思錄,Travel Coder - Arch, Coding, Life Learning](https://liudanking.com) -* [jasper的技术小窝](http://www.opscoder.info) -* [三月沙](https://sanyuesha.com/) -* [大桥下的蜗牛](https://blog.lab99.org/) -* [煎鱼的迷之博客](https://eddycjy.com/posts/) -* [Stefno - 博客园](https://www.cnblogs.com/qcrao-2018/) -* [No Headback](http://xargin.com/) -* [Go 语言基础](https://github.com/weirubo/learn_go) -* [chai2010 的博客](https://chai2010.cn/) diff --git a/Books.md b/Books.md index c4fe8b5b..6ebbda62 100644 --- a/Books.md +++ b/Books.md @@ -1,1043 +1,4 @@ -Other book lists: +The Go wiki on GitHub has moved to go.dev (#61940). -* [Awesome Go Books](https://github.com/dariubs/GoBooks) -* [Go Language Resources](http://go-lang.cat-v.org/books) +Try or . -Sorted by publication date, ascending. - -## Languages - -- [English](#english) -- [Chinese](#chinese) -- [Japanese](#japanese) -- [French](#french) -- [German](#german) -- [Brazilian portuguese](#brazilian-portuguese) -- [Russian](#russian) -- [Spanish](#spanish) -- [Korean](#korean) -- [Indonesian](#indonesian) -- [Italian](#italian) -- [Polish](#polish) -- [Persian](#persian) - -# English - * **Go Programming** - * Author: John P. Baugh - * Publication Date: June 16, 2010 - * ISBN: 978-1453636671 - - * **The Way to Go: A Thorough Introduction to the Go Programming Language** - * Author: Ivo Balbaert - * Publication Date: March 7, 2012 - * ISBN: 978-1469769165 - - * **The Go Programming Language Phrasebook** - * Author: David Chisnall - * Publication Date: April 30, 2012 - * ISBN: 978-0321817143 - * Reference: https://www.informit.com/store/go-programming-language-phrasebook-9780321817143 - - * **Programming in Go: Creating Applications for the 21st Century** - * Author: Mark Summerfield - * Publication Date: May 4, 2012 - * ISBN: 978-0321774637 - * Reference: https://www.informit.com/store/programming-in-go-creating-applications-for-the-21st-9780321774637 - - * **An Introduction to Programming in Go** - * Author: Caleb Doxsey - * Publication Date: September 3, 2012 - * ISBN: 978-1478355823 - * Reference: https://www.golang-book.com/ - - * **Mastering Concurrency in Go** - * Author: Nathan Kozyra - * Publication Date: July 23, 2014 - * ISBN: 978-1783983483 - * Reference: https://www.packtpub.com/application-development/mastering-concurrency-go - - * **The Little Go Book** - * Author: Karl Seguin - * Publication Date: October 2014 - * ISBN: none: free ebook/PDF/online version - * Reference: https://openmymind.net/The-Little-Go-Book/ - - * **Go Programming Blueprints** - * Author: Mat Ryer - * Publication Date: January 23, 2015 - * ISBN: 978-1783988020 - * Reference: https://www.packtpub.com/application-development/go-programming-blueprints - - * **Level Up Your Web Apps With Go** - * Author: Mal Curtis - * Publication Date: April, 2015 - * ISBN: 978-0992461294 - * Reference: https://learnable.com/books/level-up-your-web-apps-with-go - - * **Mastering Go Web Services** - * Author: Nathan Kozyra - * Publication Date: April, 2015 - * ISBN: 9781783981304 - * Reference: https://www.packtpub.com/web-development/mastering-go-web-services - - * **Go In Action** - * Authors: William Kennedy with Brian Ketelsen and Erik St. Martin - * Publication Date: November, 2015 - * ISBN: 9781617291784 - * Reference: https://www.manning.com/books/go-in-action - * Discount Code (44% off): goiaucf - - * **The Go Programming Language (Addison-Wesley Professional Computing Series)** - * Author: Alan A.A. Donovan and Brian Kernighan - * Publication Date: November, 2015 - * ISBN: 978-0134190440 - * Reference: https://www.gopl.io/ - -* **Web Development with Go: Building Scalable Web Apps and RESTful Services** - * Author: Shiju Varghese - * Publication Date: December, 2015 - * ISBN: 978-1484210536 - * Reference: https://www.apress.com/9781484210536 - -* **Go Programming by Example** (e-book) - * Author: Agus Kurniawan - * Publication Date: February 21, 2015 - * ISBN: -- - * Reference: https://www.amazon.com/dp/B00TWLZVQQ/ - -* **Introducing Go** - * Author: Caleb Doxsey - * Publication Date: January 2016 - * ISBN: 978-1491941959 - * Reference: https://shop.oreilly.com/product/0636920046516.do - -* **Write webapps in Go without using a framework** (Free e-book) - * Author: Suraj Patil - * Publication Date: October 2016 - * ISBN: NA since book is self published on http://leanpub.com - * References: https://github.com/thewhitetulip/web-dev-golang-anti-textbook, https://leanpub.com/antitextbookGo/ - -* **Learning Go Web Development** - * Author: Nathan Kozyra - * Publication Date: April, 2016 - * ISBN: 978-1785282317 - * Reference: https://www.packtpub.com/web-development/learning-go-web-development - -* **Go Web Programming** - * Author: Sau Sheong Chang - * Publication Date: July 22, 2016 - * ISBN: 9781617292569 - * Reference: http://manning.com/chang/ - -* **Go: Building Web Applications** - * Author: Nathan Kozyra and Mat Ryer - * Publication Date: August 31, 2016 - * ISBN: 9781787123496 - * https://www.packtpub.com/product/go-building-web-applications/9781787123496 - -* **Go in Practice** - * Authors: Matt Butcher and Matt Farina - * Publication Date: October 1, 2016 - * ISBN: 9781633430075 - * Reference: http://manning.com/butcher/ - -* **Go Programming Blueprints - Second Edition** - * Author: Mat Ryer - * Publication Date: October 2016 - * ISBN: 978-1786468949 - * Reference: https://www.packtpub.com/application-development/go-programming-blueprints-second-edition - -* **Learning Go programming** - * Author: Vladimir Vivien - * Publication Date: October 2016 - * ISBN: 978-1784395438 - * Reference: https://www.packtpub.com/application-development/learning-go-programming - -* **Go Recipes** - * Author: Shiju Varghese - * Publication Date: November 2016 - * ISBN: 978-1-4842-1188-5 - * Reference: http://www.apress.com/us/book/9781484211892 - -* **Cloud Native Go: Building Web Applications and Microservices for the Cloud with Go and React** - * Author: Kevin Hoffman and Dan Nemeth - * Publication Date: December 23, 2016 - * ISBN: 978-0-672-33779-6 - * Reference: https://www.informit.com/store/cloud-native-go-building-web-applications-and-microservices-9780672337796 - -* **Go Design Patterns** - * Author: Mario Castro Contreras - * Publication Date: February 2017 - * ISBN: 978-1786466204 - * Reference: https://www.packtpub.com/application-development/go-design-patterns - -* **Go Cookbook** - * Author: Aaron Torres - * Publication Date: June 2017 - * ISBN: 978-1783286836 - * Reference: https://www.packtpub.com/application-development/go-cookbook - -* **Go: Design Patterns for Real-World Projects** - * Authors: Vladimir Vivien, Mario Castro Contreras, Mat Ryer - * Publication Date: June 2017 - * ISBN: 978-1788390552 - * Reference: https://www.packtpub.com/application-development/go-design-patterns-real-world-projects - -* **Web Development with Go: Learn to Create Real World Web Applications using Go** - * Author: Jonathan Calhoun - * Publication Date: June 2017 - * ISBN: N/A (self published) - * Reference: [http://usegolang.com](http://usegolang.com) - -* **Building Microservices with Go** - * Author: Nic Jackson - * Publication Date: July 2017 - * ISBN: 978-1786468666 - * Reference: https://www.packtpub.com/application-development/building-microservices-go - -* **Concurrency in Go** - * Author: Katherine Cox-Buday - * Publication Date: August 2017 - * ISBN: 978-1491941195 - * Reference: http://shop.oreilly.com/product/0636920046189.do - -* **Machine Learning With Go** - * Author: Daniel Whitenack - * Publication Date: September 2017 - * ISBN: 978-1785882104 - * Reference: https://www.packtpub.com/big-data-and-business-intelligence/machine-learning-go - -* **Go Systems Programming** - * Author: Mihalis Tsoukalos - * Publication Date: September 2017 - * ISBN: 978-1787125643 - * Reference: https://www.packtpub.com/networking-and-servers/go-systems-programming - -* **Let's Go! Learn to Build Professional Web Applications With Go** - * Author: Alex Edwards - * Publication Date: September 2017 - * ISBN: N/A (self-published) - * Reference: https://lets-go.alexedwards.net - -* **Learning Functional Programming in Go** - * Author: Lex Sheehan - * Publication Date: November 2017 - * ISBN: 978-1787281394 - * Reference: https://www.packtpub.com/application-development/learning-functional-programming-go - -* **Cloud Native programming with Golang** - * Author: Mina Andrawos, Martin Helmich - * Publication Date: December 2017 - * ISBN: 978-1787125988 - * Reference: https://www.packtpub.com/application-development/cloud-native-programming-golang - -* **Isomorphic Go** - * Author: Kamesh Balasubramanian - * Publication Date: December 2017 - * ISBN: 978-1788394185 - * Reference: - * https://www.packtpub.com/web-development/isomorphic-go - * https://www.amazon.com/dp/1788394186 - -* **Security with Go** - * Author: John Daniel Leon - * Publication Date: January 2018 - * ISBN: 978-1788627917 - * Reference: https://www.amazon.com/dp/1788627911 - -* **Go Standard Library Cookbook** - * Author: Radomir Sohlich - * Publication Date: February 2018 - * ISBN: 9781788475273 - * Reference: https://www.amazon.com/dp/1788475275 - -* **Distributed Computing with Go** - * Author: V.N. Nikhil Anurag - * Publication Date: February 2018 - * ISBN: 9781787125384 - * Reference: https://www.amazon.com/dp/1787125386 - - * **Go Web Development Cookbook** - * Author: Arpit Aggarwal - * Publication Date: April 2018 - * ISBN: 9781787286740 - * Reference: https://www.amazon.com/Web-Development-Cookbook-full-stack-applications/dp/1787286746 - -* **Mastering Go** - * Author: Mihalis Tsoukalos - * Publication Date: April 2018 - * ISBN: 9781788626545 - * Reference: https://www.amazon.com/Mastering-production-applications-concurrency-cloud-native/dp/1788626540 - -* **Echo Quick Start Guide** - * Author: J. Ben Huson - * Publication Date: May 2018 - * ISBN: 9781789139433 - * Reference: https://www.amazon.com/dp/1789139430 - -* **Hands-On Serverless Applications with Go** - * Author: Mohamed Labouardy - * Publication Date: August 2018 - * ISBN: 9781789134612 - * Reference: https://www.packtpub.com/application-development/hands-serverless-applications-go - -* **Hands-On Go Programming** - * Author: Tarik Guney - * Publication Date: August 2018 - * ISBN: 9781789531756 - * Reference: https://www.packtpub.com/application-development/hands-go-programming - -* **Get Programming with Go** - * Author: Nathan Youngman, Roger Peppe - * Publication Date: August 2018 - * ISBN: 9781617293092 - * Reference: [https://www.manning.com/books/get-programming-with-go](https://www.manning.com/books/get-programming-with-go?utm_source=nathany&utm_medium=affiliate&utm_campaign=book_youngman_get_9_17_18&a_aid=nathany&a_bid=53f68821) - -* **Go Machine Learning Projects** - * Author: Xuanyi Chew - * Publication Date: November 2018 - * ISBN: 9781788993401 - * Reference: https://www.packtpub.com/big-data-and-business-intelligence/go-machine-learning-projects - -* **Hands-On Dependency Injection in Go** - * Author: Corey Scott - * Publication Date: November 2018 - * ISBN: 9781789132762 - * Reference: https://www.packtpub.com/application-development/hands-dependency-injection-go - -* **Hands-On Software Architecture with Golang** - * Author: Jyotiswarup Raiturkar - * Publication Date: December 2018 - * ISBN: 9781788622592 - * Reference: https://www.packtpub.com/application-development/hands-software-architecture-golang - -* **Hands-On Fundamentals of Data Science with Go (Video)** - * Author: Sanket Gupta - * Publication Date: December 2018 - * ISBN: 9781789539103 - * Reference: https://www.packtpub.com/big-data-and-business-intelligence/hands-fundamentals-data-science-go-video - -* **Building RESTful APIs with Go (Video)** - * Author: Bartlomiej Walczak - * Publication Date: December 2018 - * ISBN: 978178961499 - * Reference: https://www.packtpub.com/application-development/building-restful-apis-go-video - -* **Go Web Scraping Quick Start Guide** - * Author: Vincent Smith - * Publication Date: January 2019 - * ISBN: 9781789615708 - * Reference: https://www.packtpub.com/big-data-and-business-intelligence/go-web-scraping-quick-start-guide - -* **Advanced Go Programming in 7 Days (Video)** - * Author: Theofanis Despoudis - * Publication Date: January 2019 - * ISBN: 9781788994880 - * Reference: https://www.packtpub.com/application-development/advanced-go-programming-7-days-video - -* **Hands-On GUI Application Development in Go** - * Author: Andrew Williams - * Publication Date: February 2019 - * ISBN: 9781789138412 - * Reference: https://www.packtpub.com/application-development/hands-gui-application-development-go - -* **Hands-On Full Stack Development with Go** - * Author: Mina Andrawos - * Publication Date: March 2019 - * ISBN: 9781789130751 - * Reference: https://www.packtpub.com/web-development/hands-full-stack-development-go - -* **Learn Data Structures and Algorithms with Golang** - * Author: Bhagvan Kommadi - * Publication Date: March 2019 - * ISBN: 9781789618501 - * Reference: https://www.packtpub.com/application-development/learn-data-structures-and-algorithms-golang - -* **Machine Learning With Go - Second Edition** - * Author: Daniel Whitenack - * Publication Date: April 2019 - * ISBN: 9781789619898 - * Reference: https://www.packtpub.com/big-data-and-business-intelligence/machine-learning-go-second-edition?utm_source=Golang&utm_medium=referral&utm_campaign=Outreach - -* **Machine Learning with Go Quick Start Guide** - * Author: Michael Bironneau and Toby Coleman - * Publication Date: May 2019 - * ISBN: 9781838550356 - * Reference: https://www.packtpub.com/big-data-and-business-intelligence/machine-learning-go-quick-start-guide?utm_source=Golang&utm_medium=referral&utm_campaign=Outreach - -* **Mastering Go - Second Edition** - * Author: Mihalis Tsoukalos - * Publication Date: 10 Sept 2019 - * ISBN: 9781838559335 - * Reference: https://www.packtpub.com/programming/mastering-go-second-edition - * Reference: https://www.amazon.com/Mastering-production-applications-concurrency-structures/dp/1838559337/ - -* **Hands-on Microservices with Go and MongoDB [Video]** - * Author: Gautam Rege - * Publication Date: 22 Nov 2019 - * ISBN: 9781838648558 - * References: https://www.packtpub.com/web-development/hands-on-microservices-with-go-and-mongodb-video?utm_source=Golang&utm_medium=&utm_campaign=Outreach - -* **The Go Workshop** (e-book) - * Author: Delio D'Anna - * Publication Date: December 30, 2019 - * ISBN: 9781838647940 - * References: https://www.packtpub.com/programming/the-go-workshop?utm_source=GoLang&utm_medium=Github&utm_campaign=OutreachB14177dollar5 - -* **Concise Go** - * Author: Yaniv Astamnep - * Publication Date: January 22, 2020 - * ISBN: 9798602419887 - * References: - * https://www.amazon.com/Concise-Go-Yaniv-Astamnep-ebook/dp/B0844MWN92 - * https://www.amazon.com/Concise-Go-Yaniv-Astamnep/dp/B083XVZ2BZ - -* **Black Hat Go** - * Author: Tom Steele, Chris Patten, and Dan Kottmann - * Publication Date: January 24, 2020 - * ISBN: 978-1-59327-865-6 - * Reference: https://www.nostarch.com/blackhatgo - -* **Hands-On Software Engineering with Golang** - * Author: Hands-On Software Engineering with Golang - * Publication Date: January 24, 2020 - * ISBN: 978-1-83855-449-1 - * Reference: https://www.packtpub.com/product/hands-on-software-engineering-with-golang/9781838554491 - -* **Nonsequential and Distributed Programming with Go** - * Author: Christian Maurer - * Publication Date: January 21, 2021 - * ISBN: 978-3-658-29781-7 (Softcover) and 978-3-658-20782-4 (eBook) - * References: - * https://www.springer.com/gp/book/9783658297817 - - -* **Building Cross-Platform GUI Applications with Fyne** - * Author: Andrew Williams - * Publication Date: January 2021 - * ISBN: 9781800563162 - * Reference: https://www.packtpub.com/product/building-cross-platform-gui-applications-with-fyne/9781800563162 - -* **Hands-on Go programming** - * Author: Sachchidanand Singh, Prithvipal Singh - * Publication Date: February 2021 - * ISBN: 9789389898194 - * Reference: https://bpbonline.com/products/hands-on-go-programming - -* **Learning Go: An Idiomatic Approach to Real-World Go Programming** - * Author: Jon Bodner - * Publication Date: March 23, 2021 - * Reference: https://www.oreilly.com/library/view/learning-go/9781492077206/ - -* **Network Programming with Go** - * Author: Adam Woodbeck - * Publication Date: March 25, 2021 - * Reference: https://nostarch.com/networkprogrammingwithgo - -* **Distributed Services with Go: Your Guide to Reliable, Scalable, and Maintainable Systems** - * Author: Travis Jeffery - * Publication Date: March 2021 - * ISBN: 9781680507607 - * Reference: https://pragprog.com/titles/tjgo/distributed-services-with-go/ - -* **Cloud Native Go** - * Author: Matthew A. Titmus - * Publication Date: May 11, 2021 - * ISBN: 9781492076339 - * Reference: https://www.oreilly.com/library/view/cloud-native-go/9781492076322/ - -* **Building Distributed Applications in Gin** - * Author: Mohamed Labouardy - * Publication Date: July 23, 2021 - * Reference: https://www.packtpub.com/product/building-distributed-applications-in-gin/9781801074858 - -* **Ultimate Go Notebook** - * Author: William Kennedy and Hoanh An - * Publication Date: August 13, 2021 - * Reference: https://courses.ardanlabs.com/courses/ultimate-go-notebook - -* **Mastering Go - Third Edition** - * Author: Mihalis Tsoukalos - * Publication Date: 31 August 2021 - * ISBN-10: 1801079315 - * ISBN-13: 978-1801079310 - * Reference: https://www.packtpub.com/product/mastering-go-third-edition/9781801079310 - * Reference: https://www.amazon.com/Mastering-Go-professional-utilities-concurrent-dp-1801079315/dp/1801079315 - -* **Go Optimizations 101** - * Author: Tapir Liu - * Publication Date: 22 December 2021 - * Reference: https://go101.org/optimizations/101.html - -* **Go Details & Tips 101** - * Author: Tapir Liu - * Publication Date: 22 December 2021 - * Reference: https://go101.org/details-and-tips/101.html - -* **Powerful Command-Line Applications in Go** - * Author: Ricardo Gerardi - * Publication Date: December 2021 - * ISBN: 9781680506969 - * Reference: https://pragprog.com/titles/rggo/powerful-command-line-applications-in-go/ - -* **Go Generics 101** - * Author: Tapir Liu - * Publication Date: 07 April 2021 - * Reference: https://go101.org/generics/101.html - -* **Know Go: Generics** (e-book) - * Author: John Arundel - * Publication Date: April 2022 - * Reference: https://bitfieldconsulting.com/books/generics - -* **The Power of Go: Tools** (e-book) - * Author: John Arundel - * Publication Date: September 2022 - * Reference: https://bitfieldconsulting.com/books/tools - -* **The Power of Go: Tests** (e-book) - * Author: John Arundel - * Publication Date: September 2022 - * Reference: https://bitfieldconsulting.com/books/tests - -* **For the Love of Go** (e-book) - * Author: John Arundel - * Publication Date: September 2022 - * Reference: https://bitfieldconsulting.com/books/love - -* **100 Go Mistakes and How to Avoid Them** - * Author: Teiva Harsanyi - * Publication Date: October 2022 - * ISBN: 9781617299599 - * Reference: https://www.manning.com/books/100-go-mistakes-and-how-to-avoid-them - -*** -## Early Access - - * **A Comprehensive Guide to Go Programming** - * Authors: Baiju Muthukadan - * Publication Date: June 10, 2015 - * ISBN: --- - * Reference: http://golang.muthukadan.net/ - -* **WebAssembly in Action** - * Author: Gerard Gallant - * Publication Date: Spring 2019 (estimated) - * ISBN: 9781617295744 - * Reference: https://www.manning.com/books/webassembly-in-action - -* **Build an Orchestrator in Go** - * Author: Tim Boring - * Publication Date: May 2022 (estimated) - * ISBN: 9781617299759 - * Reference: https://www.manning.com/books/build-an-orchestrator-in-go - -* **Effective Go** - * Author: Effective Go - * Publication Date: Fall 2022 (estimated) - * ISBN: 9781617299896 - * Reference: https://www.manning.com/books/effective-go - -* **Efficient Go** - * Author: Bartlomiej Plotka and Frederic Branczyk - * Publication Date: December 2022 - * ISBN: 9781098105648 - * Reference: https://www.oreilly.com/library/view/efficient-go/9781098105709/ - -* **gRPC Microservices in Go** - * Authors: Huseyin BABAL - * Publication Date: Spring 2023 - * ISBN: --- - * Reference: https://shortener.manning.com/44lB - -## Available without Publication Date - - * **Learning Go** (e-book) - * Author: Miek Gieben - * Publication Date: --- - * ISBN: --- - * Reference: http://archive.miek.nl/projects/learninggo/ - - * **Network Programming with Go** (e-book) - * Author: Jan Newmarch - * Publication Date: --- - * ISBN: --- - * References: http://jan.newmarch.name/go/ - - * **Go Bootcamp** (e-book) - * Author: Matt Aimonetti - * Publication Date: --- - * ISBN: --- - * References: http://www.golangbootcamp.com/ - - * **A Go Developer's Notebook** (e-book) - * Author: Eleanor McHugh - * Publication Date: --- - * ISBN: --- - * References: https://leanpub.com/GoNotebook - - * **Go, The Standard Library** (e-book) - * Author: Daniel Huckstep - * Publication Date: --- - * ISBN: --- - * References: http://thestandardlibrary.com/go.html - - * **Practical Cryptography with Go** (e-book) - * Author: Kyle Isom - * Publication Date: --- - * ISBN: --- - * References: https://leanpub.com/gocrypto - - * **The Ultimate Guide to Building Database-Driven Apps with Go** (e-book) - * Author: Baron Schwartz - * Publication Date: --- - * ISBN: --- - * References: https://vividcortex.com/resources/building-database-driven-apps-with-go/ - - * **Building Web Apps with Go** (e-book) - * Author: Jeremy Saenz - * Publication Date: --- - * ISBN: --- - * References: https://www.gitbook.com/book/codegangsta/building-web-apps-with-go/details - - * **How do I Write and Deploy Simple Web Apps with Go?** (e-book) - * Author: Satish Talim - * Publication Date: --- - * ISBN: --- - * References: https://leanpub.com/howdoibuildawebappwithgo - - * **Test-driven development with Go** (e-book) - * Author: Yigal Duppen - * Publication Date: --- - * ISBN: --- - * References: https://leanpub.com/golang-tdd - - * **Learn Go** (e-book) - * Author: Gyu-ho Lee - * Publication Date: --- - * ISBN: --- - * References: https://github.com/gyuho/learn#contents - - * **Learn Golang the Hard Way** (e-book) - * Author: Laszlo Csontos - * Publication Date: --- - * ISBN: --- - * References: http://www.learngolangthehardway.org/ - - * **Go 101** (e-book) - * Author: Tapir Liu - * Publication Date: --- - * ISBN: --- - * References: https://go101.org - - * **Creative DIY Microcontroller Projects with TinyGo and WebAssembly** - * Author: Tobias Theel - * Publication Date: May 2021 - * ISBN: 9781800560208 - * References: https://www.packtpub.com/product/creative-diy-microcontroller-projects-with-tinygo-and-webassembly/9781800560208 - - * **Go for Javascript Developers** - * Author: Maor Zamski and Daniel Singer - * Publication Date: --- - * ISBN: --- - * References: https://github.com/pazams/go-for-javascript-developers - - * **Learn Go with Tests** - * Author: Chris James - * Publication Date: --- - * ISBN: --- - * References: https://quii.gitbook.io/learn-go-with-tests/ - - * **Practical Go Lessons** - * Author: Maximilien Andile - * Publication Date: --- - * ISBN: --- - * References: https://www.practical-go-lessons.com/ - - -## Cancelled or Status Indeterminable - - * **Microservices in Go** - * Authors: Matthew Campbell - * Publication Date: Fall 2015 (est.) - * ISBN: --- - * Reference: http://microservicesingo.com/ - * Status: [Cancelled per O'Reilly Employee](http://support.oreilly.com/oreilly/topics/availability-of-microservices-in-go-use-go-to-build-scalable-backends-by-matthew-campbell) - -# Chinese - * **Go语言·云动力** - * Author: 樊虹剑(fango) - * Publication Date: 2012-06 - * ISBN: 978-7-115-28307-8 - * Reference: http://www.ituring.com.cn/book/1040 - - * **Go语言编程** - * Author: 许式伟 - * Publication Date: 2012-08 - * ISBN: 978-7-115-29036-6 - * Reference: http://www.ituring.com.cn/book/967 - - * **Go Web编程** - * Author: 谢孟军 - * Publication Date: 2013-05 - * ISBN: 9787121200915 - * Reference: https://github.com/astaxie/build-web-application-with-golang/ - - * **Go语言程序设计 (Programming in Go: Creating Applications for the 21st Century)** - * Author: Mark Summerfield - * Translator: 许式伟, 吕桂华, 徐立, 何李石 - * Publication Date: 2013-08 - * ISBN: 978-7-115-31790-2 - * Reference: https://www.ptpress.com.cn/shopping/buy?bookId=27c4a9e0-e3df-4cb4-8992-b42c2e4368e8 - - * **Go并发编程实战** - * Author: 郝林 - * Publication Date: 2015-01-01 - * ISBN: 9787115373984 - * Reference: http://www.ptpress.com.cn/Book.aspx?id=39783 - - * **学习 Go 语言** (e-book / Translation) - * Author: Xing Xing (mikespook) - * Publication Date: --- - * ISBN: --- - * Reference: http://www.mikespook.com/learning-go/ - - * **Go 学习笔记 - 第四版** (e-book) - * Author: 雨痕(qyuhen) - * Publication Date: --- - * ISBN: --- - * Reference: https://github.com/qyuhen/book - - * **Go语言高级编程** (实体书 & e-book) - * Author: 柴树杉(chai2010) - * Publication Date: 2019-07 - * ISBN: 978-7-115-51036-5 - * Reference: https://www.epubit.com/bookDetails?id=N40090 - * Reference: https://github.com/chai2010/advanced-go-programming-book - - * **Go语言定制指南** (实体书 & e-book) - * Author: 柴树杉(chai2010) - * Publication Date: 2022-03 - * ISBN: 978-7-115-58441-0 - * Reference: https://www.epubit.com/bookDetails?id=UBc86f749c1eb7 - * Reference: https://github.com/chai2010/go-ast-book - - * **Go语言101** (e-book) - * Author: 老貘 - * Publication Date: --- - * ISBN: --- - * References: https://gfw.go101.org/ - - * **µGo语言实现——如何从头开发一个迷你Go语言编译器** (e-book) - * Author: 柴树杉(chai2010) - * Publication Date: --- - * ISBN: --- - * Reference: https://github.com/chai2010/ugo-compiler-book - -# Japanese - * **はじめての「Go言語」** - * Author: 茨木 隆彰 - * Publication Date: 2010-11 - * ISBN: 978-4777515592 - * Reference: - - * **Go言語プログラミング入門on Google App Engine** - * Author: 横山 隆司 - * Publication Date: 2011-12 - * ISBN: 978-4798031804 - * Reference: - - * **はじめてのGoogle App Engine Go言語編** - * Author: 茨木 隆彰 - * Publication Date: 2012-2 - * ISBN: 978-4777516605 - * Reference: - - * **プログラミング言語Goフレーズブック** - * Author: David Chisnall (著), デイビッド・チズナール (著), 柴田 芳樹 (翻訳) - * Publication Date: 2012-10 - * ISBN: 978-4864010962 - * Reference: - - * **基礎からわかる Go言語** - * Author: 古川 昇 - * Publication Date: 2012-11 - * ISBN: 978-4863541177 - * Reference: - - * **Go言語によるWebアプリケーション開発** - * Author: Mat Ryer (著)、鵜飼 文敏 (監訳)、牧野 聡 (訳) - * Publication Date: 2016-01 - * ISBN: 978-4-87311-752-2 - * Reference: http://www.oreilly.co.jp/books/9784873117522/ - - * **プログラミング言語Go** - * Authors: Alan A. A. Donovan, Brian W. Kernighan; translated by Yoshiki Shibata - * Publication Date: 20 June 2016 - * ISBN: 978-4-62130-025-1 - * Reference: http://www.gopl.io/translations.html - - * **みんなのGo言語** - * Authors: 松木雅幸, mattn, 藤原俊一郎, 中島大一, 牧 大輔, 鈴木健太 - * Publication Date: 9 Sep 2016 - * ISBN: 978-4774183923 - * Reference: http://www.amazon.co.jp/exec/obidos/ASIN/477418392X/ - - * **Go言語による並行処理** - * Authors: Katherine Cox-Buday(著)、山口 能迪(訳) - * Publication Date: 26 Oct 2018 - * ISBN: 978-4-87311-846-8 - * Reference: https://www.oreilly.co.jp/books/9784873118468/ - - * **改訂2版 みんなのGo言語** - * Authors: 松木雅幸, mattn, 藤原俊一郎, 中島大一, 上田 拓也, 牧 大輔, 鈴木健太 - * Publication Date: August 1, 2019 - * ISBN: 978-4297107277 - * Reference: https://gihyo.jp/book/2019/978-4-297-10727-7 - - * **Go言語プログラミングエッセンス** - * Authors: mattn - * Publication Date: Mar 9, 2023 - * ISBN: 978-4297134198 - * Reference: https://gihyo.jp/book/2023/978-4-297-13419-8 - -# French - - * **Programmer en Go - Pourquoi ? Comment ?** - * Author: Rudy Rigot - * Publication Date: 24 Jan 2018 - * ISBN: 978-2-8227-0660-5 - * Reference: https://www.d-booker.fr/go-bases/499-programmer-en-go-pourquoi-comment.html - - * **Le langage Go - Les fondamentaux du langage** - * Author: Frédéric G. Marand - * Publication Date: 23 Jun 2020 - * ISBN: 978-2100804108 - * Reference (book site): https://osinet.fr/go/ - * Reference (publisher): https://www.dunod.com/sciences-techniques/langage-go-fondamentaux-du-langage - - -# German - * **Programmierung in Google Go** (not available for buying any more) - * Authors: Rainer Feike and Steffen Blass - * Publication Date: 2010-11 - * ISBN: 978-3-8632-4722-5 - * Reference (Amazon): http://www.amazon.de/Programmierung-Google-Beispiele-professionelle-Anwendung/dp/3827330092 - * Reference (Google Books): https://books.google.de/books?id=E4IL5dT1yLsC&printsec=frontcover&hl=de#v=onepage&q&f=false - - * **Systemprogrammierung in Google Go** - * Author: Frank Müller - * Publication Date: 2011-01 - * ISBN: 978-3-89864-712-0 - * Reference: http://dpunkt.de/buecher/3762/-systemprogrammierung-in-google-go.html - - * **Nichtsequentielle und Verteilte Programmierung mit Go** (4th edition) (available as print and e-book) - * Author: Christian Maurer - * Publication Date: 2019-07 - * ISBN: 978-3-658-26289-1 (Softcover) and 978-3-658-26290-7 (eBook) - * Reference: https://www.springer.com/de/book/9783658262891 - - * **Einstieg in Google Go** (e-book) - * Author: Christian Himpel and Mario Deilmann - * Publication Date: 2012-04 - * ISBN: 978-3-86802-415-9 - * Reference: http://entwickler.de/press/Einstieg-in-Google-Go - -# Brazilian Portuguese - * **A Linguagem de Programação Go** - * Author: Alan A. A. Donovan, Brian W. Kernighan - * Publication Date: 2017 - * ISBN: 978-85-7522-546-2 - * Reference: https://novatec.com.br/livros/linguagem-de-programacao-go/ - - * **Programando em Go: crie aplicações com a linguagem do Google** - * Author: Caio Filipini - * Publication Date: 2014-07-01 - * ISBN: 978-85-66250-49-7 - * Reference: http://www.casadocodigo.com.br/products/livro-google-go - - * **Introdução à Linguagem Go: Crie Programas Escaláveis e Confiáveis** - * Author: Caleb Doxsey - * Publication Date: 2016-08-04 - * ISBN: 978-85-75224-89-2 - * Reference: http://shop.oreilly.com/product/0636920046516.do - -# Russian - * **Программирование на языке Go** - * Author: Марк Саммерфильд - * Publication Date: 2013-02-14 - * ISBN: 978-5-94074-854-0 - * Reference: http://dmkpress.com/catalog/computer/programming/978-5-94074-854-0/ - - * **Язык программирования Go** - * Author: Алан А. А. Донован, Брайан У. Керниган - * Publication Date: 2016-04-21 - * ISBN: 978-5-8459-2051-5 - * Reference: http://www.williamspublishing.com/Books/978-5-8459-2051-5.html - - * **Go на практике** - * Author: Батчер М., Фарина М. - * Publication Date: 2017-01 - * ISBN: 978-5-97060-477-9 - * Reference: http://dmkpress.com/catalog/computer/programming/978-5-97060-477-9/ - - * **Golang для профи: работа с сетью, многопоточность, структуры данных и машинное обучение с Go** - * Author: Цукалос М. - * Publication Date: 2020 - * ISBN: 978-5-4461-1617-1 - * Reference: https://www.piter.com/product/golang-dlya-profi-rabota-s-setyu-mnogopotochnost-struktury-dannyh-i-mashinnoe-obuchenie-s-go - -# Español - * **Aprende Go en Y minutos**https://go101.org - * Author: Nacho Pacheco - * Publication Date: 2015-02-24 - * ISBN: --- - * Reference: https://www.gitbook.com/book/nachopacheco/aprende-go-en-y-minutos/ - - * **Constr­uyendo­ aplic­acione­s Web ­con Go** - * Author: Nacho Pacheco - * Publication Date: 2015-02-18 - * ISBN: --- - * Reference: https://www.gitbook.com/book/nachopacheco/cawg/ - - * **¡Go en Español!** - * Author: Nacho Pacheco - * Publication Date: 2015-03-22 - * ISBN: --- - * Reference: https://www.gitbook.com/book/nachopacheco/go-es/ - -# Korean - * **가장 빨리 만나는 Go 언어** - * Author: 이재홍 - * Publication Date: June 2015 - * ISBN: 978-8-96618-990-8 - * Reference: http://www.pyrasis.com/private/2015/06/01/publish-go-for-the-really-impatient-book - - * **개발자를 위한 하룻밤에 읽는 Go 언어 이야기** - * Author: 신제용 - * Publication Date: December 2015 - * ISBN: 978-8-96848-806-1 - * Reference: http://www.hanbit.co.kr/store/books/look.php?p_code=E8544486990 - - * **디스커버리 Go 언어** - * Author: 염재현 - * Publication Date: March 2016 - * ISBN: 9788-96848-268-7 - * Reference: http://www.hanbit.co.kr/store/books/look.php?p_code=B5279497767 - - * **Go 언어 웹 프로그래밍 철저 입문** - * Author: 장재휴 - * Publication Date: March 2016 - * ISBN: 979-1-18697-881-8 - * Reference: http://www.gilbut.co.kr/book/bookView.aspx?bookcode=BN001434 - - * **Go 인 액션** - * Authors: William Kennedy with Brian Ketelsen and Erik St. Martin; translated by Hyunhee Jang - * Publication Date: June 2016 - * ISBN: 979-1-18589-053-1 - * Reference: http://jpub.tistory.com/585 - - * **The Go Programming Language** - * Authors: Alan A. A. Donovan, Brian W. Kernighan; translated by Seung Lee - * Publication Date: June 2016 - * ISBN: 978-0-13419-044-0 - * Reference: http://www.acornpub.co.kr/book/go-programming - - * **Go 웹 프로그래밍** - * Author: Sau Sheong Chang; translated by Jinwook Jeong - * Publication Date: March 2017 - * ISBN: 979-1-18669-731-3 - * Reference: http://www.bjpublic.co.kr/skin12/productSearchView.php?board_data=aWR4PTIxMyZzdGFydFBhZ2U9MCZsaXN0Tm89MzM - - * **프로젝트로 완성하는 Go 프로그래밍** - * Author: Mat Ryer; translated by Soonbeom Kwon - * Publication Date: August 2017 - * ISBN: 979-1-16175-032-3 - * Reference: http://www.acornpub.co.kr/book/go-blueprints-2 - - * **Go 언어 실전 테크닉** - * Authors: 松木雅幸, mattn, 藤原俊一郎, 中島大一, 牧 大輔, 鈴木健太; translated by Hyuntae Park - * Publication Date: August 2017 - * ISBN: 979-1-16175-026-2 - * Reference: http://www.acornpub.co.kr/book/go-language-minna - - * **Go Cookbook** - * Author: Aaron Torres; transalted by Sangsik Lee - * Publication Date: December 2017 - * ISBN: 979-1-16175-088-0 - * Reference: http://www.acornpub.co.kr/book/go-cookbook - - * **Go 언어를 활용한 마이크로서비스 개발** - * Author: Nic Jackson; translated by Sangsik Lee - * Publication Date: July 2018 - * ISBN: 979-1-16175-190-0 - * Reference: http://www.acornpub.co.kr/book/microservices-go - - * **Go 언어 시작하기** - * Author: 박혜영, 서정인 - * Publication Date: September 2018 - * ISBN: 979-1-15600-606-0 - * Reference: http://www.hongpub.co.kr/sub.php?goPage=view_product&flashpage=&Code=20180911072243 - - * **Go 마스터하기** - * Author: Mihalis Tsoukalos; translated by Kihyuk Nam - * Publication Date: October 2018 - * ISBN: 979-1-16175-208-2 - * Reference: http://acornpub.co.kr/book/mastering-go - -# Indonesian - * **Bahasa Pemrograman Go** - * Author: Sajarwo Anggai - * Publication Date: October 21, 2013 - * ISBN: --- - * Reference: https://sajarwo87.wordpress.com/2013/10/21/buku-bahasa-pemrograman-go/ - - * **Dasar Pemrograman Golang** - * Author: Noval Agung Prayogo - * Publication Date: Oktober 30, 2015 - * ISBN: --- - * Reference: https://dasarpemrogramangolang.novalagung.com - -# Italian - * **Programmare in Linguaggio Go** - * Author: Renato Mite - * Publication Date: 9 Oct 2016 - * ISBN: --- - * Reference (Amazon): https://www.amazon.it/dp/B01M2URIVX - * Reference (Google Books): https://play.google.com/store/books/details/Renato_Mite_Programmare_in_Linguaggio_Go?id=4Ag6DQAAQBAJ - * Reference (Kobo Books): https://store.kobobooks.com/it-it/ebook/programmare-in-linguaggio-go - * Repository: https://github.com/rmite/gobook - -# Polish - - * **Język Go. Poznaj i programuj** - * Authors: Alan A. A. Donovan, Brian W. Kernighan; translated by Lech Lachowski - * Publication Date: July 2016 - * ISBN: 978-83-283-2467-1 - * Reference: https://helion.pl/ksiazki/jezyk-go-poznaj-i-programuj-alan-a-a-donovan-brian-w-kernighan,jgopop.htm - -# Persian - * **GoFarsi book** - * Author: Javad Rajabzadeh - * Publication Date: 23 oct 2022 - * ISBN: --- - * Repository: https://github.com/GoFarsi/book - * LiveBook: https://book.gofarsi.ir - - * **Go Succinctly** - * Author: Amir Irani - * Publication Date: 10 Jun 2018 - * ISBN: --- - * Repository: https://github.com/thedevsir/gosuccinctly - -# Looking for contributors - -[Add Go books here that are looking for writers, editors, Gopher illustrators, and translators.] - - * **Go Web Development Cookbook** - * Author: Arpit Aggarwal - * Publication Date: April 2018 - * ISBN: 9781787286740 - * Reference: https://www.amazon.in/Web-Development-Cookbook-full-stack-applications/dp/1787286746 - -*** \ No newline at end of file diff --git a/BoundingResourceUse.md b/BoundingResourceUse.md index 9e08f60b..988bc9ac 100644 --- a/BoundingResourceUse.md +++ b/BoundingResourceUse.md @@ -1,28 +1,4 @@ -To bound a program's use of a limited resource - like memory - have goroutines synchronize their use of that resource using a buffered channel (i.e., use the channel as a semaphore): +The Go wiki on GitHub has moved to go.dev (#61940). -```go -const ( - AvailableMemory = 10 << 20 // 10 MB - AverageMemoryPerRequest = 10 << 10 // 10 KB - MaxOutstanding = AvailableMemory / AverageMemoryPerRequest -) +Try or . -var sem = make(chan int, MaxOutstanding) - -func Serve(queue chan *Request) { - for { - sem <- 1 // Block until there's capacity to process a request. - req := <-queue - go handle(req) // Don't wait for handle to finish. - } -} - -func handle(r *Request) { - process(r) // May take a long time & use a lot of memory or CPU - <-sem // Done; enable next request to run. -} -``` - -## References - -Effective Go's discussion of channels: https://go.dev/doc/effective_go#channels \ No newline at end of file diff --git a/CSSStyleGuide.md b/CSSStyleGuide.md index 0743d271..4f8a5925 100644 --- a/CSSStyleGuide.md +++ b/CSSStyleGuide.md @@ -1,220 +1,4 @@ -# Go CSS Coding Guidelines +The Go wiki on GitHub has moved to go.dev (#61940). -**Please [discuss changes](https://go.dev/issue/new?title=wiki%3A+CSSStyleGuide+change&body=&labels=Documentation) before editing this page**, even _minor_ ones. Many people have opinions and this is not the place for edit wars. +Try or . -Go's naming conventions are adapted from [Medium's style guide](https://gist.github.com/fat/a47b882eb5f84293c4ed#javascript) and the work being done in the [SUIT CSS framework](https://github.com/suitcss/suit/blob/master/doc/naming-conventions.md). Which is to say, it relies on _structured class names_ and _meaningful hyphens_ (i.e., not using hyphens merely to separate words). This is to help work around the current limits of applying CSS to the DOM (i.e., the lack of style encapsulation) and to better communicate the relationships between classes. - -We require plain CSS over preprocessors like LESS, SASS, etc. This is to avoid additional tooling dependencies. - -## JavaScript - -syntax: `js-` - -JavaScript-specific classes reduce the risk that changing the structure or theme of components will inadvertently affect any required JavaScript behavior and complex functionality. You must use these classes if you interact with the DOM via JavaScript. In practice this looks like this: - -``` - -``` - -Again, JavaScript-specific classes should not, under any circumstances, be styled. - -## Components - -Syntax: `[namespace-][-descendantName][--modifierName]` - -Component driven development offers several benefits when reading and writing HTML and CSS: - -* It helps to distinguish between the classes for the root of the component, descendant elements, and modifications. -* It keeps the specificity of selectors low. -* It helps to decouple presentation semantics from document semantics. - -You can think of components as custom elements that enclose specific semantics, styling, and behavior. - -### namespace (optional) - -If necessary, components can be prefixed with a namespace. For example, you may wish to avoid the potential for collisions between libraries and your custom components by prefixing all your components with a namespace. - -``` -.godoc-Button { /* … */ } -.godoc-Tabs { /* … */ } -``` - -This makes it clear, when reading the HTML, which components are part of your library. - -### ComponentName - -The component's name must be written in camel case. - -``` -.MyComponent { /* … */ } -
- … -
-``` - -### ComponentName--modifierName - -A component modifier is a class that modifies the presentation of the base component in some form. Modifier names must be written in camel case and be separated from the component name by two hyphens. The class should be included in the HTML _in addition_ to the base component class. - -``` -/* Core button */ -.Button { /* … */ } -/* Default button style */ -.Button--default { /* … */ } - -``` - -### ComponentName-descendantName - -A component descendant is a class that is attached to a descendant node of a component. It's responsible for applying presentation directly to the descendant on behalf of a particular component. Descendant names must be written in camel case. - -``` -
-
- {$alt} - … -
-
- … -
-
-``` - -### ComponentName[aria-] - -Almost always, component states can be represented using ARIA (aria-expanded, aria-disabled, etc.) so they are recommended for state-based modifications of components. In the very rare case that there is a state that cannot be represented using ARIA, a CSS class of the format `is-stateName` can be used. The CSS state name must be Camel case. Never style these attributes/classes directly; they should always be used as an adjoining class or attribute. - -JS can add/remove these attributes/classes. Every component must define its own styles for the state (as they are scoped to the component). - -``` -.Tweet { /* … */ } -.Tweet[aria-expanded=true] { /* … */ } -.Tweet.is-blorked { /* … */ } -
- … -
-``` - -### Colors - -Prefer lower-case hex values, RGB, or RGBA over named, HSL, or HSLA values. Use short-form hex values where applicable. - -Right: - -``` -#fff; -#f1f2f3; -rgb(50, 50, 50); -rgba(50, 50, 50, 0.2); -``` - -Wrong: - -``` -#FFFFFF; -#F1F2F3; -white; -hsl(120, 100%, 50%); -hsla(120, 100%, 50%, 1); -``` - -## Formatting - -The following are some high level page formatting style rules. - -### Spacing - -CSS rules should be comma separated but live on new lines: - -Right: - -``` -.Content, -.Content-edit { - … -} -``` - -Wrong: - -``` -.Content, .Content-edit { - … -} -``` - -CSS blocks should be separated by a single new line. not two. not 0. - -Right: - -``` -.Content { - … -} -.Content-edit { - … -} -``` - -Wrong: - -``` -.Content { - … -} - -.Content-edit { - … -} -``` - -### Quotes - -Quotes are optional in CSS. We use single quotes as it is visually clearer that the string is not a selector or a style property. - -Right: - -``` -background-image: url('/img/you.jpg'); -font-family: 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, Arial; -``` - - -Wrong: - -``` -background-image: url(/img/you.jpg); -font-family: Helvetica Neue Light, Helvetica Neue, Helvetica, Arial; -``` - -## Write Simple Selectors - -Avoid sequences of simple selectors ("compound selectors"). - -The only exceptions are state-based selectors that are dynamically added to indicate a state change (for example, a tweet that has "[aria-expanded=true]"). - -Right: - -``` -/* State-based simple selector. */ -tweet[aria-expanded=true] { - ... -} -``` - -Wrong: - -``` -/* Sequence of simple selectors. */ -button.foo.bar { - ... -} -``` - -## Images - -Add height and width attributes to images in the html markup to help minimize layout shift during page load. - -``` - -``` diff --git a/ChromeOS.md b/ChromeOS.md index e15971eb..338a0f8e 100644 --- a/ChromeOS.md +++ b/ChromeOS.md @@ -1,46 +1,4 @@ -# Introduction +The Go wiki on GitHub has moved to go.dev (#61940). -You don't need to compile from source in Developer mode, you can just use the [Chromebrew](https://github.com/skycocker/chromebrew)-provided version. +Try or . -If your Chromebook is relatively new, you can enable the Linux VM now built into ChromeOS to install Go without developer mode. Follow the steps from the following Google Support article to enable this feature- https://support.google.com/chromebook/answer/9145439. This has been tested on a Samsung Chromebook Plus on version 71.0.3578.127. If this feature is not available for you, you will need to enable Developer Mode. - -This tutorial will show you how to install, build, and run Go on Chrome OS. -Please note this has only been tested on a 64GB LTE Pixel, however it should work on other Chromebooks. Note that enabling developer mode reduces the security guarantees offered by Chrome OS. - -# Install Go -First download the latest version of Go for Linux from the [Go Downloads page](https://go.dev/dl/). -After that, open a shell by hitting (CTRL+ALT+T) and typing in `shell` then hit enter. Then extract it using the following command (when replacing `< Go Linux package >` with the name of the file you downloaded): - -``` -sudo tar xpvf ~/Downloads/< Go Linux package > -C /usr/local -``` - -Go should now be installed you can test this by typing `/usr/local/go/bin/go`. If it installed correctly, you should see the Go help prompt. Go is now installed. - -# Create a Workspace -To keep this simple just create a folder called `/usr/local/go/work`. Also, create a folder called `src` inside `/usr/local/go/work/`. - -# Set PATH -Add the following to `~/.bashrc`: -``` -export GOPATH="/usr/local/go/work" -export PATH="${PATH}:/usr/local/go/bin:${GOPATH}/bin" -``` -This will allow you to run your Go programs in your shell. - -# Test if it worked -First create a folder inside of your `/usr/local/go/src` folder. After that create a file in your folder called `hello.go` with the following in it: -```go -package main - -import "fmt" - -func main() { - fmt.Println("Hello, Chrome OS!") -} -``` -Now, run `go install hello`. Then, run `${GOPATH}/bin/hello` (or just `hello` if you setup your GOPATH above) and you should see `Hello, Chrome OS!`. -*** - -# Reporting bugs -Please go to [Issues](https://github.com/golang/go/issues) to report any issues you have. diff --git a/CodeReview.md b/CodeReview.md index 72508434..1b9fec59 100644 --- a/CodeReview.md +++ b/CodeReview.md @@ -1,54 +1,4 @@ -Be sure to familiarize yourself with the code review process from the official [Contribution Guide](https://go.dev/doc/contribute) first. +The Go wiki on GitHub has moved to go.dev (#61940). -# Reviewer Parlance +Try or . -There are several terms code reviews may use that you should become familiar with. - -* ` LGTM ` — looks good to me -* ` SGTM ` — sounds good to me -* ` PTAL ` — please take a look -* ` s/foo/bar/ ` — please replace ` foo ` with ` bar `; this is [sed syntax](http://en.wikipedia.org/wiki/Sed#Usage) -* ` s/foo/bar/g ` — please replace ` foo ` with ` bar ` throughout your entire change - -# CL Directives - -* `R=foo` — assign a reviewer within the [Go CL dashboard](https://swtch.com/godash/) -* `RELNOTE=yes` or `RELNOTE=` — tag for release notes; scraped by the [relnote](https://golang.org/x/build/cmd/relnote) tool -* `DO NOT SUBMIT` (in the commit message) — block submission; see the "Work in progress" section below -* `Updates #1234` or `Fixes #1234` (in the commit message) — link the CL from the GitHub issue and optionally close the issue after the CL is merged - -# Email - -Messages from a code review are typically sent to three places: - -* the reviewers, if any -* the golang-codereviews group -* the owner - -Please do NOT reply code review via email, as the message [will not be relayed to Gerrit](https://code.google.com/p/gerrit/issues/detail?id=228). Always click on the link and post reply in Gerrit. - -# Work in progress - -If you have changes that aren't ready to be reviewed, you can put a giant **`DO NOT REVIEW`** as the second line of the CL description, so that people who see it know not to look any further. Don't make it the first line, since then it will become the subject for the entire review, even after you've changed the description. - -Similarly, if you would like to ensure that your changes are not merged by mistake, you can put **`DO NOT SUBMIT`** as the second line of the CL description. - -If you don't need Gerrit's features, but just want to backup your work, share work between multiple clients, or have a staging UI to examine your changes, you can use a regular git remote. - -To use GitHub as a git remote, you can either fork github.com/golang/go or create a new repo. There are trade-offs. Forked repos will have a faster first push. Non-forked repos can be private. Forked repos are associated in GitHub's system. As a result, they are easily discoverable and support cross-repo comparisons in the GitHub UI; however, this also means that references to issues in commit messages in forked repos will create references to your fork in the issue. - -To add your git remote, run something like: - -```bash -$ git remote add fork git@github.com:yourusername/go.git -``` - -You can then push changes to the "fork" remote with `git push fork branchname`. - -Gerrit's code review model is to rewrite a single commit until it is correct. GitHub will try to prevent you from accidentally overwriting your existing branch. You can work around this by forcing the push: `git push --force fork branchname`. Alternatively, you can set up your forked remote as a mirror by cloning it initially with: - -```bash -$ git remote add --mirror=push fork git@github.com:yourusername/go.git -``` - -Then running `git push fork` will update GitHub to perfectly mirror *everything* (all branches, all tags, etc.). This is handy, but take care when using this on multiple clients. You are bypassing the usual git safeguards, so it is easy to overwrite (and thus lose) work pushed by a different client. \ No newline at end of file diff --git a/CodeReviewComments.md b/CodeReviewComments.md index 5b7da3c6..6a1ebe43 100644 --- a/CodeReviewComments.md +++ b/CodeReviewComments.md @@ -1,617 +1,4 @@ -# Go Code Review Comments +The Go wiki on GitHub has moved to go.dev (#61940). -This page collects common comments made during reviews of Go code, so -that a single detailed explanation can be referred to by shorthands. -This is a laundry list of common style issues, not a comprehensive style guide. +Try or . -You can view this as a supplement to [Effective Go](https://go.dev/doc/effective_go). - -Additional comments related to testing can be found at [Go Test Comments](https://github.com/golang/go/wiki/TestComments) - -Google has published a longer [Go Style Guide](https://google.github.io/styleguide/go/decisions). - -**Please [discuss changes](https://go.dev/issue/new?title=wiki%3A+CodeReviewComments+change&body=&labels=Documentation) before editing this page**, even _minor_ ones. Many people have opinions and this is not the place for edit wars. - -* [Gofmt](#gofmt) -* [Comment Sentences](#comment-sentences) -* [Contexts](#contexts) -* [Copying](#copying) -* [Crypto Rand](#crypto-rand) -* [Declaring Empty Slices](#declaring-empty-slices) -* [Doc Comments](#doc-comments) -* [Don't Panic](#dont-panic) -* [Error Strings](#error-strings) -* [Examples](#examples) -* [Goroutine Lifetimes](#goroutine-lifetimes) -* [Handle Errors](#handle-errors) -* [Imports](#imports) -* [Import Blank](#import-blank) -* [Import Dot](#import-dot) -* [In-Band Errors](#in-band-errors) -* [Indent Error Flow](#indent-error-flow) -* [Initialisms](#initialisms) -* [Interfaces](#interfaces) -* [Line Length](#line-length) -* [Mixed Caps](#mixed-caps) -* [Named Result Parameters](#named-result-parameters) -* [Naked Returns](#naked-returns) -* [Package Comments](#package-comments) -* [Package Names](#package-names) -* [Pass Values](#pass-values) -* [Receiver Names](#receiver-names) -* [Receiver Type](#receiver-type) -* [Synchronous Functions](#synchronous-functions) -* [Useful Test Failures](#useful-test-failures) -* [Variable Names](#variable-names) - -## Gofmt - -Run [gofmt](https://pkg.go.dev/cmd/gofmt/) on your code to automatically fix the majority of mechanical style issues. Almost all Go code in the wild uses `gofmt`. The rest of this document addresses non-mechanical style points. - -An alternative is to use [goimports](https://pkg.go.dev/golang.org/x/tools/cmd/goimports), a superset of `gofmt` which additionally adds (and removes) import lines as necessary. - -## Comment Sentences - -See https://go.dev/doc/effective_go#commentary. Comments documenting declarations should be full sentences, even if that seems a little redundant. This approach makes them format well when extracted into godoc documentation. Comments should begin with the name of the thing being described and end in a period: - -```go -// Request represents a request to run a command. -type Request struct { ... - -// Encode writes the JSON encoding of req to w. -func Encode(w io.Writer, req *Request) { ... -``` - -and so on. - -## Contexts - -Values of the context.Context type carry security credentials, -tracing information, deadlines, and cancellation signals across API -and process boundaries. Go programs pass Contexts explicitly along -the entire function call chain from incoming RPCs and HTTP requests -to outgoing requests. - -Most functions that use a Context should accept it as their first parameter: - -``` -func F(ctx context.Context, /* other arguments */) {} -``` - -A function that is never request-specific may use context.Background(), -but err on the side of passing a Context even if you think you don't need -to. The default case is to pass a Context; only use context.Background() -directly if you have a good reason why the alternative is a mistake. - -Don't add a Context member to a struct type; instead add a ctx parameter -to each method on that type that needs to pass it along. The one exception -is for methods whose signature must match an interface in the standard library -or in a third party library. - -Don't create custom Context types or use interfaces other than Context in -function signatures. - -If you have application data to pass around, put it in a parameter, -in the receiver, in globals, or, if it truly belongs there, in a Context value. - -Contexts are immutable, so it's fine to pass the same ctx to multiple -calls that share the same deadline, cancellation signal, credentials, -parent trace, etc. - -## Copying - -To avoid unexpected aliasing, be careful when copying a struct from another package. -For example, the bytes.Buffer type contains a `[]byte` slice. If you copy a `Buffer`, -the slice in the copy may alias the array in the original, causing subsequent method -calls to have surprising effects. - -In general, do not copy a value of type `T` if its methods are associated with the -pointer type, `*T`. - -## Crypto Rand - -Do not use package `math/rand` to generate keys, even throwaway ones. -Unseeded, the generator is completely predictable. Seeded with `time.Nanoseconds()`, -there are just a few bits of entropy. Instead, use `crypto/rand`'s Reader, -and if you need text, print to hexadecimal or base64: - -``` go -import ( - "crypto/rand" - // "encoding/base64" - // "encoding/hex" - "fmt" -) - -func Key() string { - buf := make([]byte, 16) - _, err := rand.Read(buf) - if err != nil { - panic(err) // out of randomness, should never happen - } - return fmt.Sprintf("%x", buf) - // or hex.EncodeToString(buf) - // or base64.StdEncoding.EncodeToString(buf) -} -``` - -## Declaring Empty Slices - -When declaring an empty slice, prefer - -```go -var t []string -``` - -over - -```go -t := []string{} -``` - -The former declares a nil slice value, while the latter is non-nil but zero-length. They are functionally equivalent—their `len` and `cap` are both zero—but the nil slice is the preferred style. - -Note that there are limited circumstances where a non-nil but zero-length slice is preferred, such as when encoding JSON objects (a `nil` slice encodes to `null`, while `[]string{}` encodes to the JSON array `[]`). - -When designing interfaces, avoid making a distinction between a nil slice and a non-nil, zero-length slice, as this can lead to subtle programming errors. - -For more discussion about nil in Go see Francesc Campoy's talk [Understanding Nil](https://www.youtube.com/watch?v=ynoY2xz-F8s). - -## Doc Comments - -All top-level, exported names should have doc comments, as should non-trivial unexported type or function declarations. See https://go.dev/doc/effective_go#commentary for more information about commentary conventions. - -## Don't Panic - -See https://go.dev/doc/effective_go#errors. Don't use panic for normal error handling. Use error and multiple return values. - -## Error Strings - -Error strings should not be capitalized (unless beginning with proper nouns or acronyms) or end with punctuation, since they are usually printed following other context. That is, use `fmt.Errorf("something bad")` not `fmt.Errorf("Something bad")`, so that `log.Printf("Reading %s: %v", filename, err)` formats without a spurious capital letter mid-message. This does not apply to logging, which is implicitly line-oriented and not combined inside other messages. - -## Examples - -When adding a new package, include examples of intended usage: a runnable Example, -or a simple test demonstrating a complete call sequence. - -Read more about [testable Example() functions](https://go.dev/blog/examples). - -## Goroutine Lifetimes - -When you spawn goroutines, make it clear when - or whether - they exit. - -Goroutines can leak by blocking on channel sends or receives: the garbage collector -will not terminate a goroutine even if the channels it is blocked on are unreachable. - -Even when goroutines do not leak, leaving them in-flight when they are no longer -needed can cause other subtle and hard-to-diagnose problems. Sends on closed channels -panic. Modifying still-in-use inputs "after the result isn't needed" can still lead -to data races. And leaving goroutines in-flight for arbitrarily long can lead to -unpredictable memory usage. - -Try to keep concurrent code simple enough that goroutine lifetimes are obvious. -If that just isn't feasible, document when and why the goroutines exit. - -## Handle Errors - -See https://go.dev/doc/effective_go#errors. Do not discard errors using `_` variables. If a function returns an error, check it to make sure the function succeeded. Handle the error, return it, or, in truly exceptional situations, panic. - -## Imports - -Avoid renaming imports except to avoid a name collision; good package names -should not require renaming. In the event of collision, prefer to rename the most -local or project-specific import. - - -Imports are organized in groups, with blank lines between them. -The standard library packages are always in the first group. - -```go -package main - -import ( - "fmt" - "hash/adler32" - "os" - - "github.com/foo/bar" - "rsc.io/goversion/version" -) -``` - -goimports will do this for you. - -## Import Blank - -Packages that are imported only for their side effects (using the syntax `import -_ "pkg"`) should only be imported in the main package of a program, or in tests -that require them. - -## Import Dot - -The import . form can be useful in tests that, due to circular dependencies, cannot be made part of the package being tested: - -```go -package foo_test - -import ( - "bar/testutil" // also imports "foo" - . "foo" -) -``` - -In this case, the test file cannot be in package foo because it uses bar/testutil, which imports foo. So we use the 'import .' form to let the file pretend to be part of package foo even though it is not. Except for this one case, do not use import . in your programs. It makes the programs much harder to read because it is unclear whether a name like Quux is a top-level identifier in the current package or in an imported package. - -## In-Band Errors - -In C and similar languages, it's common for functions to return values like -1 -or null to signal errors or missing results: - -```go -// Lookup returns the value for key or "" if there is no mapping for key. -func Lookup(key string) string - -// Failing to check for an in-band error value can lead to bugs: -Parse(Lookup(key)) // returns "parse failure for value" instead of "no value for key" -``` - -Go's support for multiple return values provides a better solution. -Instead of requiring clients to check for an in-band error value, a function should return -an additional value to indicate whether its other return values are valid. This return -value may be an error, or a boolean when no explanation is needed. -It should be the final return value. - -``` go -// Lookup returns the value for key or ok=false if there is no mapping for key. -func Lookup(key string) (value string, ok bool) -``` - -This prevents the caller from using the result incorrectly: - -``` go -Parse(Lookup(key)) // compile-time error -``` - -And encourages more robust and readable code: - -``` go -value, ok := Lookup(key) -if !ok { - return fmt.Errorf("no value for %q", key) -} -return Parse(value) -``` - -This rule applies to exported functions but is also useful -for unexported functions. - -Return values like nil, "", 0, and -1 are fine when they are -valid results for a function, that is, when the caller need not -handle them differently from other values. - -Some standard library functions, like those in package "strings", -return in-band error values. This greatly simplifies string-manipulation -code at the cost of requiring more diligence from the programmer. -In general, Go code should return additional values for errors. - -## Indent Error Flow - -Try to keep the normal code path at a minimal indentation, and indent the error handling, dealing with it first. This improves the readability of the code by permitting visually scanning the normal path quickly. For instance, don't write: - -```go -if err != nil { - // error handling -} else { - // normal code -} -``` - -Instead, write: - -```go -if err != nil { - // error handling - return // or continue, etc. -} -// normal code -``` - -If the `if` statement has an initialization statement, such as: - -```go -if x, err := f(); err != nil { - // error handling - return -} else { - // use x -} -``` - -then this may require moving the short variable declaration to its own line: - -```go -x, err := f() -if err != nil { - // error handling - return -} -// use x -``` - -## Initialisms - -Words in names that are initialisms or acronyms (e.g. "URL" or "NATO") have a consistent case. For example, "URL" should appear as "URL" or "url" (as in "urlPony", or "URLPony"), never as "Url". As an example: ServeHTTP not ServeHttp. For identifiers with multiple initialized "words", use for example "xmlHTTPRequest" or "XMLHTTPRequest". - -This rule also applies to "ID" when it is short for "identifier" (which is pretty much all cases when it's not the "id" as in "ego", "superego"), so write "appID" instead of "appId". - -Code generated by the protocol buffer compiler is exempt from this rule. Human-written code is held to a higher standard than machine-written code. - -## Interfaces - -Go interfaces generally belong in the package that uses values of the -interface type, not the package that implements those values. The -implementing package should return concrete (usually pointer or struct) -types: that way, new methods can be added to implementations without -requiring extensive refactoring. - -Do not define interfaces on the implementor side of an API "for mocking"; -instead, design the API so that it can be tested using the public API of -the real implementation. - -Do not define interfaces before they are used: without a realistic example -of usage, it is too difficult to see whether an interface is even necessary, -let alone what methods it ought to contain. - -``` go -package consumer // consumer.go - -type Thinger interface { Thing() bool } - -func Foo(t Thinger) string { … } -``` - -``` go -package consumer // consumer_test.go - -type fakeThinger struct{ … } -func (t fakeThinger) Thing() bool { … } -… -if Foo(fakeThinger{…}) == "x" { … } -``` - -``` go -// DO NOT DO IT!!! -package producer - -type Thinger interface { Thing() bool } - -type defaultThinger struct{ … } -func (t defaultThinger) Thing() bool { … } - -func NewThinger() Thinger { return defaultThinger{ … } } -``` - -Instead return a concrete type and let the consumer mock the producer implementation. -``` go -package producer - -type Thinger struct{ … } -func (t Thinger) Thing() bool { … } - -func NewThinger() Thinger { return Thinger{ … } } -``` - -## Line Length - -There is no rigid line length limit in Go code, but avoid uncomfortably long lines. -Similarly, don't add line breaks to keep lines short when they are more readable long--for example, -if they are repetitive. - -Most of the time when people wrap lines "unnaturally" (in the middle of function calls or -function declarations, more or less, say, though some exceptions are around), the wrapping would be -unnecessary if they had a reasonable number of parameters and reasonably short variable names. -Long lines seem to go with long names, and getting rid of the long names helps a lot. - -In other words, break lines because of the semantics of what you're writing (as a general rule) -and not because of the length of the line. If you find that this produces lines that are too long, -then change the names or the semantics and you'll probably get a good result. - -This is, actually, exactly the same advice about how long a function should be. There's no rule -"never have a function more than N lines long", but there is definitely such a thing as too long -of a function, and of too repetitive tiny functions, and the solution is to change where the function -boundaries are, not to start counting lines. - -## Mixed Caps - -See https://go.dev/doc/effective_go#mixed-caps. This applies even when it breaks conventions in other languages. For example an unexported constant is `maxLength` not `MaxLength` or `MAX_LENGTH`. - -Also see [Initialisms](https://github.com/golang/go/wiki/CodeReviewComments#initialisms). - -## Named Result Parameters - -Consider what it will look like in godoc. Named result parameters like: - -```go -func (n *Node) Parent1() (node *Node) {} -func (n *Node) Parent2() (node *Node, err error) {} -``` - -will be repetitive in godoc; better to use: - -```go -func (n *Node) Parent1() *Node {} -func (n *Node) Parent2() (*Node, error) {} -``` - -On the other hand, if a function returns two or three parameters of the same type, -or if the meaning of a result isn't clear from context, adding names may be useful -in some contexts. Don't name result parameters just to avoid declaring a var inside -the function; that trades off a minor implementation brevity at the cost of -unnecessary API verbosity. - - -```go -func (f *Foo) Location() (float64, float64, error) -``` - -is less clear than: - -```go -// Location returns f's latitude and longitude. -// Negative values mean south and west, respectively. -func (f *Foo) Location() (lat, long float64, err error) -``` - -Naked returns are okay if the function is a handful of lines. Once it's a medium -sized function, be explicit with your return values. Corollary: it's not worth it -to name result parameters just because it enables you to use naked returns. -Clarity of docs is always more important than saving a line or two in your function. - -Finally, in some cases you need to name a result parameter in order to change -it in a deferred closure. That is always OK. - - -## Naked Returns - -A `return` statement without arguments returns the named return values. This is known as a "naked" return. - -```go -func split(sum int) (x, y int) { - x = sum * 4 / 9 - y = sum - x - return -} -``` - -See [Named Result Parameters](#named-result-parameters). - -## Package Comments - -Package comments, like all comments to be presented by godoc, must appear adjacent to the package clause, with no blank line. - -```go -// Package math provides basic constants and mathematical functions. -package math -``` - -```go -/* -Package template implements data-driven templates for generating textual -output such as HTML. -.... -*/ -package template -``` - -For "package main" comments, other styles of comment are fine after the binary name (and it may be capitalized if it comes first), For example, for a `package main` in the directory `seedgen` you could write: - -``` go -// Binary seedgen ... -package main -``` -or -```go -// Command seedgen ... -package main -``` -or -```go -// Program seedgen ... -package main -``` -or -```go -// The seedgen command ... -package main -``` -or -```go -// The seedgen program ... -package main -``` -or -```go -// Seedgen .. -package main -``` - -These are examples, and sensible variants of these are acceptable. - -Note that starting the sentence with a lower-case word is not among the -acceptable options for package comments, as these are publicly-visible and -should be written in proper English, including capitalizing the first word -of the sentence. When the binary name is the first word, capitalizing it is -required even though it does not strictly match the spelling of the -command-line invocation. - -See https://go.dev/doc/effective_go#commentary for more information about commentary conventions. - -## Package Names - -All references to names in your package will be done using the package name, -so you can omit that name from the identifiers. For example, if you are in package chubby, -you don't need type ChubbyFile, which clients will write as `chubby.ChubbyFile`. -Instead, name the type `File`, which clients will write as `chubby.File`. -Avoid meaningless package names like util, common, misc, api, types, and interfaces. See https://go.dev/doc/effective_go#package-names and -https://go.dev/blog/package-names for more. - -## Pass Values - -Don't pass pointers as function arguments just to save a few bytes. If a function refers to its argument `x` only as `*x` throughout, then the argument shouldn't be a pointer. Common instances of this include passing a pointer to a string (`*string`) or a pointer to an interface value (`*io.Reader`). In both cases the value itself is a fixed size and can be passed directly. This advice does not apply to large structs, or even small structs that might grow. - -## Receiver Names - -The name of a method's receiver should be a reflection of its identity; often a one or two letter abbreviation of its type suffices (such as "c" or "cl" for "Client"). Don't use generic names such as "me", "this" or "self", identifiers typical of object-oriented languages that gives the method a special meaning. In Go, the receiver of a method is just another parameter and therefore, should be named accordingly. The name need not be as descriptive as that of a method argument, as its role is obvious and serves no documentary purpose. It can be very short as it will appear on almost every line of every method of the type; familiarity admits brevity. Be consistent, too: if you call the receiver "c" in one method, don't call it "cl" in another. - -## Receiver Type - -Choosing whether to use a value or pointer receiver on methods can be difficult, especially to new Go programmers. If in doubt, use a pointer, but there are times when a value receiver makes sense, usually for reasons of efficiency, such as for small unchanging structs or values of basic type. Some useful guidelines: - - * If the receiver is a map, func or chan, don't use a pointer to them. If the receiver is a slice and the method doesn't reslice or reallocate the slice, don't use a pointer to it. - * If the method needs to mutate the receiver, the receiver must be a pointer. - * If the receiver is a struct that contains a sync.Mutex or similar synchronizing field, the receiver must be a pointer to avoid copying. - * If the receiver is a large struct or array, a pointer receiver is more efficient. How large is large? Assume it's equivalent to passing all its elements as arguments to the method. If that feels too large, it's also too large for the receiver. - * Can function or methods, either concurrently or when called from this method, be mutating the receiver? A value type creates a copy of the receiver when the method is invoked, so outside updates will not be applied to this receiver. If changes must be visible in the original receiver, the receiver must be a pointer. - * If the receiver is a struct, array or slice and any of its elements is a pointer to something that might be mutating, prefer a pointer receiver, as it will make the intention clearer to the reader. - * If the receiver is a small array or struct that is naturally a value type (for instance, something like the time.Time type), with no mutable fields and no pointers, or is just a simple basic type such as int or string, a value receiver makes sense. A value receiver can reduce the amount of garbage that can be generated; if a value is passed to a value method, an on-stack copy can be used instead of allocating on the heap. (The compiler tries to be smart about avoiding this allocation, but it can't always succeed.) Don't choose a value receiver type for this reason without profiling first. - * Don't mix receiver types. Choose either pointers or struct types for all available methods. - * Finally, when in doubt, use a pointer receiver. - -## Synchronous Functions - -Prefer synchronous functions - functions which return their results directly or finish any callbacks or channel ops before returning - over asynchronous ones. - -Synchronous functions keep goroutines localized within a call, making it easier to reason about their lifetimes and avoid leaks and data races. They're also easier to test: the caller can pass an input and check the output without the need for polling or synchronization. - -If callers need more concurrency, they can add it easily by calling the function from a separate goroutine. But it is quite difficult - sometimes impossible - to remove unnecessary concurrency at the caller side. - -## Useful Test Failures - -Tests should fail with helpful messages saying what was wrong, with what inputs, what was actually got, and what was expected. It may be tempting to write a bunch of assertFoo helpers, but be sure your helpers produce useful error messages. Assume that the person debugging your failing test is not you, and is not your team. A typical Go test fails like: - -```go -if got != tt.want { - t.Errorf("Foo(%q) = %d; want %d", tt.in, got, tt.want) // or Fatalf, if test can't test anything more past this point -} -``` - -Note that the order here is actual != expected, and the message uses that order too. Some test frameworks encourage writing these backwards: 0 != x, "expected 0, got x", and so on. Go does not. - -If that seems like a lot of typing, you may want to write a [[table-driven test|TableDrivenTests]]. - -Another common technique to disambiguate failing tests when using a test helper with different input is to wrap each caller with a different TestFoo function, so the test fails with that name: - -```go -func TestSingleValue(t *testing.T) { testHelper(t, []int{80}) } -func TestNoValues(t *testing.T) { testHelper(t, []int{}) } -``` - -In any case, the onus is on you to fail with a helpful message to whoever's debugging your code in the future. - -## Variable Names - -Variable names in Go should be short rather than long. This is especially true for local variables with limited scope. Prefer `c` to `lineCount`. Prefer `i` to `sliceIndex`. - -The basic rule: the further from its declaration that a name is used, the more descriptive the name must be. For a method receiver, one or two letters is sufficient. Common variables such as loop indices and readers can be a single letter (`i`, `r`). More unusual things and global variables need more descriptive names. - -See also the longer discussion in [the Google Go Style Guide](https://google.github.io/styleguide/go/decisions#variable-names). diff --git a/CodeReviewConcurrency.md b/CodeReviewConcurrency.md index b092bd04..0a0276f1 100644 --- a/CodeReviewConcurrency.md +++ b/CodeReviewConcurrency.md @@ -1,248 +1,4 @@ -# Code Review: Go Concurrency +The Go wiki on GitHub has moved to go.dev (#61940). -This page is an addition to the [Go Code Review Comments]( -https://github.com/golang/go/wiki/CodeReviewComments) list. The goal of this list is to help to find -concurrency-related bugs when reviewing Go code. +Try or . -You may also read through this list just once to refresh your memory and to make sure you are aware -of all these concurrency gotchas. - -> ⚠️ This page is community authored and maintained. It includes information that is disputed and may be misleading or incorrect. - -
- -Insufficient synchronisation and race conditions - - [HTTP handler functions are thread-safe?](#http-handlers) - - [Global functions and variables are protected by mutexes or otherwise thread-safe?]( - https://go.dev/doc/articles/race_detector#Unprotected_global_variable) - - [*Reads* of fields and variables are protected?](#sync-balance) - - [The loop variable is passed into the goroutine function as an argument?]( - https://go.dev/doc/articles/race_detector#Race_on_loop_counter) - - [Methods on thread-safe types don't return pointers to protected structures?](#return-pointer) - - [`Load()` or `Delete()` calls on a `sync.Map` after `Load()` is not a race condition? - ](#sync-map-race) - -Testing - - [Running tests with `-race` flag in CI/CD?](https://go.dev/doc/articles/race_detector) - -Scalability - - [A channel is intentionally created with zero capacity?](#zero-cap-ch) - - [*Not* using `sync.RWMutex` to protect very short operations?](#rwmutex) - -Time - - [`time.Ticker` is stopped using `defer tick.Stop()`?](#ticker-stop) - - [Comparing `time.Time` using `Equal()`, not `==`?](#time-eq) - - [Keeping the monotonic component in `time.Time` argument of `time.Since()`?](#time-since) - - [When comparing *system times* via `t.Before(u)`, the monotonic component is stripped - from the argument?](#time-before) - -
- -### Insufficient synchronisation and race conditions - - -[#](#http-handlers) RC.1. **The HTTP handler function is safe to call concurrently from -multiple goroutines?** It's easy to overlook HTTP handlers should be thread-safe because they are -usually not called explicitly from anywhere in the project code, but only from the internals of the -HTTP server. - - -[#](#sync-balance) RC.2. Is there some **field or variable access not protected by a mutex** where -the field or the variable is a primitive or of a type that is not explicitly thread-safe (such as -`atomic.Value`), while this field can be updated from a concurrent goroutine? It's not safe to skip -synchronising reads even to primitive variables because of non-atomic hardware writes and potential -memory visibility problems. - -See also a [Typical Data Race: Primitive unprotected variable]( -https://go.dev/doc/articles/race_detector#Primitive_unprotected_variable). - - -[#](#return-pointer) RC.3. **A method on a thread-safe type doesn't return a pointer to a protected -structure?** This is a subtle bug which leads to the unprotected access problem described in the -previous item. Example: -```go -type Counters struct { - mu sync.Mutex - vals map[Key]*Counter -} - -func (c *Counters) Add(k Key, amount int) { - c.mu.Lock() - defer c.mu.Unlock() - count, ok := c.vals[k] - if !ok { - count = &Counter{sum: 0, num: 0} - c.vals[k] = count - } - count.sum += amount - count.n += 1 -} - -func (c *Counters) GetCounter(k Key) *Counter { - c.mu.Lock() - defer c.mu.Unlock() - return c.vals[k] // BUG! Returns a pointer to the structure which must be protected -} -``` -One possible solution is to return a copy, not a pointer to the structure in `GetCounter()`: -```go -type Counters struct { - mu sync.Mutex - vals map[Key]Counter // Note that now we are storing the Counters directly, not pointers. -} - -... - -func (c *Counters) GetCounter(k Key) Counter { - c.mu.Lock() - defer c.mu.Unlock() - return c.vals[k] -} -``` - - -[#](#sync-map-race) RC.4. If there is more than one goroutine that can update a `sync.Map`, **you -don't call `m.Store()` or `m.Delete()` depending on the success of a previous `m.Load()` call?** -In other words, the following code is racy: -```go -var m sync.Map - -// Can be called concurrently from multiple goroutines -func DoSomething(k Key, v Value) { - existing, ok := m.Load(k) - if !ok { - m.Store(k, v) // RACE CONDITION - two goroutines can execute this in parallel - ... some other logic, assuming the value in `k` is now `v` in the map - } - ... -} -``` - -Such a race condition could be benign in some cases: for example, the logic between the `Load()` and -`Store()` calls computes the value to be cached in the map, and this computation always returns the -same result and doesn't have side effects. - -> ⚠️ **Potentially misleading information**. "Race condition" can refer to logic errors, like this example, which can be benign. But the phrase is also commonly used to refer to violations of the memory model, which are never benign. - -If the race condition is not benign, use methods [`sync.Map.LoadOrStore()`]( -https://pkg.go.dev/sync/#Map.LoadOrStore) and [`LoadAndDelete()`]( -https://pkg.go.dev/sync/#Map.LoadAndDelete) to fix it. - -### Scalability - - -[#](#zero-cap-ch) Sc.1. **Is this intentional that a channel is created with zero capacity**, like -`make(chan *Foo)`? A goroutine which sends a message to a zero-capacity channel is blocked until -another goroutine receives this message. Omitting the capacity in the `make()` call might be just -a mistake which will limit the scalability of the code, and it's likely unit test won't find such -a bug. - -> ⚠️ **Misleading information**. Buffered channels do not inherently increase "scalability" versus unbuffered channels. However, buffered channels can easily obscure deadlocks and other fundamental design errors that would be immediately apparent with unbuffered channels. - - - -[#](#rwmutex) Sc.2. Locking with `RWMutex` incurs extra overhead compared to plain `sync.Mutex`, -and, furthermore, there might be some [scalability issue with the current implementation of -`RWMutex` in Go](https://github.com/golang/go/issues/17973). Unless the case is very clear (such as -an `RWMutex` used to synchronize many read-only operations each lasting hundreds of milliseconds or -more, and the writes which require an exclusive lock seldom happen), **there should be some -benchmarks proving that `RWMutex` indeed helps to improve the performance.** A typical example where -`RWMutex` certainly does more harm than good is a simple protection of a variable in a struct: -```go -type Box struct { - mu sync.RWMutex // DON'T DO THIS -- use a simple Mutex instead. - x int -} - -func (b *Box) Get() int { - b.mu.RLock() - defer b.mu.RUnlock() - return b.x -} - -func (b *Box) Set(x int) { - b.mu.Lock() - defer b.mu.Unlock() - b.x = x -} -``` - - -### Time - - -[#](#ticker-stop) Tm.1. **Is `time.Ticker` stopped using `defer tick.Stop()`?** It's a memory leak -not to stop the ticker when the function which uses the ticker in a loop returns. - - -[#](#time-eq) Tm.2. **Are `time.Time` structs compared using `Equal()` method, not just `==`?** -Quoting the [documentation for `time.Time`](https://pkg.go.dev/time/#Time): - -> Note that the Go `==` operator compares not just the time instant but also the Location and the -> monotonic clock reading. Therefore, `Time` values should not be used as map or database keys -> without first guaranteeing that the identical Location has been set for all values, which can be -> achieved through use of the `UTC()` or `Local()` method, and that the monotonic clock reading has -> been stripped by setting `t = t.Round(0)`. In general, prefer `t.Equal(u)` to `t == u`, since -> `t.Equal()` uses the most accurate comparison available and correctly handles the case when only -> one of its arguments has a monotonic clock reading. - - -[#](#time-since) Tm.3. **Before calling `time.Since(t)`, the monotonic component is _not_ stripped -from `t`?** This is a consequence of the previous item. If the monotonic component is stripped from -the `time.Time` structure before passing it into `time.Since()` function (via calling either -`UTC()`, `Local()`, `In()`, `Round()`, `Truncate()`, or `AddDate()`) **the result of `time.Since()` -might be negative** on very rare occasions, such as if the system time has been synced via NTP between -the moment when the start time was originally obtained and the moment when `time.Since()` is called. -If the monotonic component is *not* stripped, `time.Since()` will always return a positive duration. - - -[#](#time-before) Tm.4. **If you want to compare *system times* via `t.Before(u)`, do you strip -the monotonic component from the argument,** e.g. via `u.Round(0)`? This is another point related to -[Tm.2](#time-eq). Sometimes, you need to compare two `time.Time` structs only by the system -time stored in them, specifically. You may need this before storing one of these `Time` structs on -disk or sending them over the network. Imagine, for example, some sort of telemetry agent which -pushes a telemetry metric together with time periodically to some remote system: -```go -var latestSentTime time.Time - -func pushMetricPeriodically(ctx context.Context) { - t := time.NewTicker(time.Second) - defer t.Stop() - for { - select { - case <-ctx.Done: return - case <-t.C: - newTime := time.Now().Round(0) // Strip monotonic component to compare system time only - // Check that the new time is later to avoid messing up the telemetry if the system time - // is set backwards on an NTP sync. - if latestSentTime.Before(newTime) { - sendOverNetwork(NewDataPoint(newTime, metric())) - latestSentTime = newTime - } - } - } -} -``` -This code would be wrong without calling `Round(0)`, i. e. stripping the monotonic component. - -## Reading List - -[Go Code Review Comments](https://github.com/golang/go/wiki/CodeReviewComments): a checklist for -reviewing Go code, not concurrency-specific. - -Go concurrency: - - [The Go Memory Model](https://go.dev/ref/mem) - - [Section about concurrency in *Effective Go*]( - https://go.dev/doc/effective_go#concurrency) - - Posts in The Go Blog: - - [Share Memory By Communicating](https://go.dev/blog/codelab-share) - - [Go Concurrency Patterns: Timing out, moving on](https://go.dev/blog/concurrency-timeouts) - - [Go Concurrency Patterns: Context](https://go.dev/blog/context) - - [Go Concurrency Patterns: Pipelines and cancellation](https://go.dev/blog/pipelines) - - [Advanced Go Concurrency Patterns](https://go.dev/blog/io2013-talk-concurrency) (video) - - [Rethinking Classical Concurrency Patterns](https://www.youtube.com/watch?v=5zXAHh5tJqQ) (video) - - [Understanding Real-World Concurrency Bugs in Go](https://songlh.github.io/paper/go-study.pdf) - -Concurrency, but not specific to Go: - - [Mechanical Sympathy: Single Writer Principle]( - https://mechanical-sympathy.blogspot.com/2011/09/single-writer-principle.html) \ No newline at end of file diff --git a/CodeTools.md b/CodeTools.md index ecad0c61..8537446f 100644 --- a/CodeTools.md +++ b/CodeTools.md @@ -1,69 +1,4 @@ -An overview of tools that will help improve your Go code +The Go wiki on GitHub has moved to go.dev (#61940). -## All-in-one +Try or . - - [golangci-lint](https://github.com/golangci/golangci-lint) - Bundle of `gofmt`, `golint`, `govet` and many other tools that shares work between the different linters for better performance. Recommended by the original author to replace gometalinter (Drop-in replacement). - - DEPRECATED: [gometalinter](https://github.com/alecthomas/gometalinter) - Automates the installation, configuration and application of `gofmt`, `golint`, `govet` and several other code validation tools. - -## Code Formatting - -### Articles - - - [Formatting Go Code with gofmt](http://golangtutorials.blogspot.com/2011/06/formatting-go-code-with-gofmt.html) - -### Tools - - - [air](https://github.com/cosmtrek/air) - Live reload for Go apps - - [gofmt](https://pkg.go.dev/cmd/gofmt/) - Start with the standard Go code formatter. - - [golint](https://github.com/golang/lint) - Detects style mistakes in Go code (deprecated). - - [staticcheck](https://staticcheck.io/) - Go programming language linter. - - [goimports](https://pkg.go.dev/golang.org/x/tools/cmd/goimports) - Format code and fix your import statements. - - [gofumpt](https://github.com/mvdan/gofumpt) - A stricter gofmt. - - [revive](https://github.com/mgechev/revive) - Fast, configurable, extensible, flexible, and beautiful linter for Go. - -## Code generation, Templating and Generics - - - [json-to-go](https://mholt.github.io/json-to-go/) - Generate Go structs from JSON. - - [Go gen](http://clipperhouse.github.io/gen/) - Type-driven code generation (generics) - - [gojson](https://github.com/ChimeraCoder/gojson) - Another Go struct generator. - - [gotemplate](https://github.com/ncw/gotemplate) - Package-based templating system for Go. - - [sqlgen](https://github.com/drone/sqlgen) - Generate Go code for SQL interactions. - - [zek](https://github.com/miku/zek) - Generate Go struct from XML. - - [apidocgen](https://github.com/alovn/apidocgen) - Generate web apis markdown docs and mocks. - - [goaccessor](https://github.com/yujiachen-y/goaccessor) - Getters and setters generator. - -## Refactoring - -### Articles - - - [gorename - easy refactoring](https://texlution.com/post/gorename/) - - [Refactoring Tools](http://blog.ralch.com/tutorial/golang-tools-refactoring/) - An overview of refactoring tools for Go. - - [Quick renaming with gofmt](http://technosophos.com/2015/09/26/quick-go-hack-renaming-structs.html) - -### Tools - -- [eg](https://pkg.go.dev/golang.org/x/tools/cmd/eg) - Example-based refactoring tool for Go. -- [gofmt](https://pkg.go.dev/cmd/gofmt/) - Start with the standard Go code formatter. -- [gorename](https://golang.org/x/tools/refactor/rename) - Renaming tool for Go. - -## Error Detection - -### Articles - - - [Go Inspection Tools](https://blog.ralch.com/articles/golang-tools-inspection/) - An overview of tools for Go code inspection. - -### Tools - - - [AlignCheck, StructCheck, VarCheck](https://github.com/opennota/check/) - A suite of tools for checking your code. - - [errcheck](https://github.com/kisielk/errcheck) - Ensure you check your error conditions. - - [go vet](https://pkg.go.dev/cmd/vet/) - Read this first on how to use the `go vet` command. - - [SafeSQL](https://github.com/stripe/safesql) - Protect against unsafe SQL in your code (deprecated). - -## Navigation - - - [Go Guru - User Manual](https://go.dev/s/using-guru) - A tool for understanding Go code. - - [Pythia](https://github.com/fzipp/pythia) - A browser-based UI for Go Guru. - -## Visualization - - - [godepgraph](http://github.com/kisielk/godepgraph) - A tool for generating dependency graphs of Go code. diff --git a/Comments.md b/Comments.md index 41579304..bd9ffdca 100644 --- a/Comments.md +++ b/Comments.md @@ -1,38 +1,4 @@ -# Comments +The Go wiki on GitHub has moved to go.dev (#61940). -Every package should have a package comment. It should immediately precede the ` package ` statement in one of the files in the package. (It only needs to appear in one file.) It should begin with a single sentence that begins "Package _packagename_" and give a concise summary of the package functionality. This introductory sentence will be used in godoc's list of all packages. +Try or . -Subsequent sentences and/or paragraphs can give more details. Sentences should be properly punctuated. - -```go -// Package superman implements methods for saving the world. -// -// Experience has shown that a small number of procedures can prove -// helpful when attempting to save the world. -package superman -``` - -Nearly every top-level type, const, var and func should have a comment. A comment for bar should be in the form "_bar_ floats on high o'er vales and hills.". The first letter of _bar_ should not be capitalized unless it's capitalized in the code. - -```go -// enterOrbit causes Superman to fly into low Earth orbit, a position -// that presents several possibilities for planet salvation. -func enterOrbit() os.Error { - ... -} -``` - -All text that you indent inside a comment, godoc will render as a pre-formatted block. This facilitates code samples. - -```go -// fight can be used on any enemy and returns whether Superman won. -// -// Examples: -// -// fight("a random potato") -// fight(LexLuthor{}) -// -func fight(enemy interface{}) bool { - ... -} -``` diff --git a/CommitMessage.md b/CommitMessage.md index 1b2e4932..15cbcea5 100644 --- a/CommitMessage.md +++ b/CommitMessage.md @@ -1,79 +1,4 @@ -# Commit messages +The Go wiki on GitHub has moved to go.dev (#61940). -Commit messages, also known as CL (changelist) descriptions, should be formatted per https://go.dev/doc/contribute#commit_messages. For example, +Try or . -``` -net/http: handle foo when bar - -[longer description here in the body] - -Fixes #12345 -``` - -Notably, for the subject (the first line of description): - -* the name of the package affected by the change goes before the colon -* the part after the colon uses the verb tense + phrase that completes the blank in, *"this change modifies Go to ___________"* -* the verb after the colon is lowercase -* there is no trailing period -* it should be kept as short as possible (many git viewing tools prefer under ~76 characters, though Go isn't super strict about this). - -For the body (the rest of the description): - -* the text should be wrapped to ~76 characters (to appease git viewing tools, mainly), unless you really need longer lines (e.g. for ASCII art, tables, or long links). -* the Fixes line goes after the body with a blank newline separating the two. (It is acceptable but not required to use a trailing period, such as `Fixes #12345.`). -* there is **no** Markdown in the commit message. -* we **do not** use `Signed-off-by` lines. Don't add them. Our Gerrit server & GitHub bots enforce CLA compliance instead. -* when referencing CLs, prefer saying "CL nnn" or using a go.dev/cl/nnn shortlink over a direct Gerrit URL or git hash, since that's more future-proof. -* when moving code between repos, include the CL, repository name, and git hash that it was moved from/to, so it is easier to trace history/blame. - -Please _don't_ use alternate GitHub-supported aliases like `Close` or `Resolves` instead of `Fixes`. - -To link a commit to an issue without marking it fixed—for example, if the commit is working toward a fix but not yet a complete fix—GitHub requires only that the issue is mentioned by number in the commit message. By convention, Go commits mention this at the bottom of the message using `For`, where `Fixes` might be expected, even if the number is also mentioned in the body of the commit message. - -For example: - -``` -Refactor func Foo. -This will make the handling of -shorter and easier to test. - -For #12345 -``` - -It is common in other Git projects to use `Updates` instead of `For`, and that is acceptable too, even though it makes little sense (the commit does not update the issue). More precise phrasings are fine too. Don't be too pedantic in code reviews: it's not worth asking people to change from `Updates` or something else to `For`, or vice versa. - -# Reverts - -You can roll back a change using the Gerrit `Revert` button. -Gerrit will generate a description for you. -Edit the description to add the Gerrit CL number being rolled back next to or instead of the Git revision number. - -Do not use the Gerrit UI to create a revert of a revert, as that notifies people right away. -Instead, mail it as a new change, and in the description explain that it is a roll forward of CL NNNNNN which was rolled back by CL NNNNNN. - -# Other repos - -For non-"go" repos ("crypto", "tools", "net", etc), the subject is still the name of the package, but you need to fully-qualify the issue number with the GitHub org/repo syntax: - -``` -cipher/rot13: add new super secure cipher - -Fixes golang/go#1234 -```` - -Notably, the first line subject should **not** contain the `x/crypto/` prefix. We only do that for the issue tracker. - -# Non-normative references - -- [Please heed my plea and write good CL descriptions for Go—and for any other project you work on.](https://groups.google.com/d/msg/golang-dev/6M4dmZWpFaI/SyU5Sl4zZLYJ) -- [The CL description is a public document that explains to the future what has been done and why.](https://groups.google.com/d/msg/golang-dev/s07ZUR8ZDHo/i-rIsknbAwAJ) - -# GitHub Pull Requests - -If you're using GitHub Pull Requests, your commit message is constructed by GerritBot based on your -PR's title & description. See https://go.dev/wiki/GerritBot#how-does-gerritbot-determine-the-final-commit-message. - -If somebody asks you to modify your commit message, you'll need to modify your PR. - -![](images/github-to-gerrit.png) \ No newline at end of file diff --git a/CommonMistakes.md b/CommonMistakes.md index ab463a05..04fb8c0e 100644 --- a/CommonMistakes.md +++ b/CommonMistakes.md @@ -1,142 +1,4 @@ -Table of Contents -================= +The Go wiki on GitHub has moved to go.dev (#61940). -+ [Introduction](#introduction) -+ [Using reference to loop iterator variable](#using-reference-to-loop-iterator-variable) -+ [Using goroutines on loop iterator variables](#using-goroutines-on-loop-iterator-variables) +Try or . -# Introduction - -When new programmers start using Go or when old Go programmers start using a new concept, there are some common mistakes that many of them make. Here is a non-exhaustive list of some frequent mistakes that show up on the mailing lists and in IRC. - -# Using reference to loop iterator variable - -In Go, the loop iterator variable is a single variable that takes different values in each loop iteration. This is very efficient, but might lead to unintended behavior when used incorrectly. For example, see the following program: - -```go -func main() { - var out []*int - for i := 0; i < 3; i++ { - out = append(out, &i) - } - fmt.Println("Values:", *out[0], *out[1], *out[2]) - fmt.Println("Addresses:", out[0], out[1], out[2]) -} -``` - -It will output unexpected results: - -``` -Values: 3 3 3 -Addresses: 0x40e020 0x40e020 0x40e020 -``` - -Explanation: in each iteration we append the address of `i` to the `out` slice, but since it is the same variable, we append the same address which eventually contains the last value that was assigned to `i`. One of the solutions is to copy the loop variable into a new variable: - -```diff - for i := 0; i < 3; i++ { -+ i := i // Copy i into a new variable. - out = append(out, &i) - } -``` - -The new output of the program is what was expected: - -``` -Values: 0 1 2 -Addresses: 0x40e024 0x40e028 0x40e032 -``` - -Explanation: the line `i := i` copies the loop variable `i` into a new variable scoped to the for loop body block, also called `i`. The address of the new variable is the one that is appended to the array, which makes it outlive the for loop body block. In each loop iteration a new variable is created. - -While this example might look a bit obvious, the same unexpected behavior could be more hidden in some other cases. For example, the loop variable can be an array and the reference can be a slice: - -```go -func main() { - var out [][]int - for _, i := range [][1]int{{1}, {2}, {3}} { - out = append(out, i[:]) - } - fmt.Println("Values:", out) -} -``` - -Output: -``` -Values: [[3] [3] [3]] -``` - -The same issue can be demonstrated also when the loop variable is being used in a Goroutine (see the following section). - -# Using goroutines on loop iterator variables - -When iterating in Go, one might attempt to use goroutines to process data in parallel. For example, you might write something like this, using a closure: - -```go -for _, val := range values { - go func() { - fmt.Println(val) - }() -} -``` - -The above for loops might not do what you expect because their ` val ` variable is actually a single variable that takes on the value of each slice element. Because the closures are all only bound to that one variable, there is a very good chance that when you run this code you will see the last element printed for every iteration instead of each value in sequence, because the goroutines will probably not begin executing until after the loop. - -The proper way to write that closure loop is: -```go -for _, val := range values { - go func(val interface{}) { - fmt.Println(val) - }(val) -} -``` - -By adding val as a parameter to the closure, ` val ` is evaluated at each iteration and placed on the stack for the goroutine, so each slice element is available to the goroutine when it is eventually executed. - -It is also important to note that variables declared within the body of a loop are not shared between iterations, and thus can be used separately in a closure. The following code uses a common index variable ` i ` to create separate ` val `s, which results in the expected behavior: - -```go -for i := range valslice { - val := valslice[i] - go func() { - fmt.Println(val) - }() -} -``` - -Note that without executing this closure as a goroutine, the code runs as expected. The following example prints out the integers between 1 and 10. - -```go -for i := 1; i <= 10; i++ { - func() { - fmt.Println(i) - }() -} -``` - -Even though the closures all still close over the same variable (in this case, ` i `), they are executed before the variable changes, resulting in the desired behavior. -https://go.dev/doc/faq#closures_and_goroutines - -You may find another, similar situation like the following: - -```go -for _, val := range values { - go val.MyMethod() -} - -func (v *val) MyMethod() { - fmt.Println(v) -} -``` -The above example also will print last element of values, the reason is same as closure. To fix the issue declare another variable inside the loop. - -```go -for _, val := range values { - newVal := val - go newVal.MyMethod() -} - -func (v *val) MyMethod() { - fmt.Println(v) -} -``` diff --git a/CompilerOptimizations.md b/CompilerOptimizations.md index d2aac4ca..1258a310 100644 --- a/CompilerOptimizations.md +++ b/CompilerOptimizations.md @@ -1,115 +1,4 @@ -# Compiler And Runtime Optimizations +The Go wiki on GitHub has moved to go.dev (#61940). -This page lists optimizations done by the compilers. Note that these are not guaranteed by the language specification. +Try or . -## Interface values - -### Zero-width types in interface values - -Putting a zero-width type in an interface value doesn't allocate. - -* **gc:** 1.0+ -* **gccgo:** ? - -### Word-sized value in an interface value - -Putting a word-sized-or-less non-pointer type in an interface value doesn't allocate. - -* **gc:** 1.0-1.3, but *not* in 1.4+ -* **gccgo:** never - -## `string` and `[]byte` - -### Map lookup by `[]byte` - -For a map `m` of type `map[string]T` and `[]byte b`, `m[string(b)]` doesn't allocate. (the temporary string copy of the byte slice isn't made) - -* **gc:** 1.4+ -* **gccgo:** ? - -### `range` over `[]byte`(s) - -No allocation when converting a `string` into a `[]byte` for ranging over the bytes: - -```go -s := "foo" -for i, c := range []byte(s) { - // ... -} -``` - -### conversion for string comparison - -No allocation done when converting a `[]byte` into a `string` for comparison purposes - -```go -var b1 string -var b2 []byte -var x = string(b1) == string(b2) // memeq -var y = string(b1) < string(b2) // lexicographical comparison -``` - -* **gc:** 1.5+ (CL 3790) -* **gccgo:** ? - -## Escape analysis and Inlining - -Use `-gcflags -m` to observe the result of escape analysis and inlining -decisions for the gc toolchain. - -(TODO: explain the output of `-gcflags -m`). - -### Escape analysis - -Gc compiler does global escape analysis across function and package boundaries. However, there are lots of cases where it gives up. For example, anything assigned to any kind of indirection (`*p = ...`) is considered escaped. Other things that can inhibit analysis are: function calls, package boundaries, slice literals, subslicing and indexing, etc. Full rules are too complex to describe, so check the `-m` output. - -* **gc:** 1.0+ -* **gccgo:** 8.0+. - -### Function Inlining - -Only short and simple functions are inlined. To be inlined a function must conform to the rules: - -- function should be simple enough, the number of AST nodes must less than the budget (80); -- function doesn't contain complex things like closures, defer, recover, select, etc; -- function isn't prefixed by go:noinline; -- function isn't prefixed by go:uintptrescapes, since the escape information will be lost during inlining; -- function has body; -- etc. - -* **gc:** 1.0+ -* **gccgo:** -O1 and above. - -## Idioms - -### Optimized memclr - -For a slice or array s, loops of the form - -```go -for i := range s { - s[i] = -} -``` - -are converted into efficient runtime memclr calls. [Issue](https://github.com/golang/go/issues/5373) and [commit](https://go.dev/change/f03c9202c43e0abb130669852082117ca50aa9b1). - -* **gc:** 1.5+ -* **gccgo:** ? - -## Non-scannable objects - -Garbage collector does not scan underlying buffers of slices, channels and maps when element type does not contain pointers (both key and value for maps). This allows to hold large data sets in memory without paying high price during garbage collection. For example, the following map won't visibly affect GC time: - -```go -type Key [64]byte // SHA-512 hash -type Value struct { - Name [32]byte - Balance uint64 - Timestamp int64 -} -m := make(map[Key]Value, 1e8) -``` - -* **gc:** 1.5+ -* **gccgo:** ? \ No newline at end of file diff --git a/Conferences.md b/Conferences.md index 61940f04..2f023128 100644 --- a/Conferences.md +++ b/Conferences.md @@ -1,173 +1,4 @@ -# Go Conferences and Major Events +The Go wiki on GitHub has moved to go.dev (#61940). -## Upcoming +Try or . -Please keep all items in chronological order. - - -| Name | Date | Location | Website | CFP | -| --- | --- | --- | --- | --- | -| FOSDEM | 2024-02-03-04 | Brussels, Belgium | https://fosdem.org/2024/ | Go Devroom CFP https://github.com/go-devroom/cfp | -| GopherCon EU, Athens | 2024-02-06-08 | Athens, Greece | https://gophercon.eu/ | https://sessionize.com/gceu24a | -| GopherCon Brazil | 2024-05-09-10 | Florianópolis, SC, Brazil | https://gopherconbr.org/en/ | https://www.papercall.io/gopherconbrazil2024 | -| GopherCon EU, Berlin | 2024-06-17-20 | Berlin, Germany | https://gophercon.eu/ | https://sessionize.com/gceu24b | - -## Archives - -Please keep all items in reverse chronological order (most recent first) - -| Name | Date | Location | Talk, Video Archives | -|------|------------|----------|----------------| -| GoLab | 2023-11-19-21 | Florence, Italy | https://golab.io | -| GopherChina | 2023-11-19 | ShangHai, China | http://gopherchina2023sh.bagevent.com | -| GopherCon AU 2023 | 2023-11-08-10 | Sydney, Australia | https://gophercon.com.au/ | -| Fyne Conf 2023 | 2023-11-03 | Edinburgh, UK | https://conf.fyne.io | -| GopherCon Singapore 2023 | 2023-11-02-03 | Singapore | https://2023.gophercon.sg | -| GoWest | 2023-10-27 | Lehi, Utah, USA | https://www.gowestconf.com/ | -| GopherCon | 2023-09-26-29 | San Diego | https://www.gophercon.com/ | -| GopherCon India | 2023-09-09-10 | Pune, India | https://gopherconindia.org | -| GopherCon UK | 2023-08-16-18 | London, UK | https://www.gophercon.co.uk/ | -| GopherCon Korea | 2023-08-05-06 | Seoul, Korea | https://festa.io/events/3435 | -| GopherCon Europe 2023 | 2023-06-26-29 | Berlin, Germany | https://gophercon.eu/, https://www.youtube.com/playlist?list=PLtoVuM73AmsJWvXYd_9rbYXcbv1UdzeLT | -| GopherChina | 2023-06-09-11 | Beijing, China | https://www.bagevent.com/event/8057917 | -| GothamGo | 2023-06-09 | New York City | https://gothamgo.com/ | -| Go Conference 2023 | 2023-06-02 | Online | https://gocon.jp/2023/ (talks coming soon) | -| Conf42: Golang 2023 | 2023-04-20 | Online | https://www.conf42.com/golang2023, https://www.youtube.com/playlist?list=PLIuxSyKxlQrBDOCy9ThDZ0kJX7skLE2ks | -| GopherCon Israel 2023 | 2023-02-07 | Tel Aviv, Israel | https://www.gophercon.org.il | -| Go Devroom FOSDEM | 2023-02-04 | Brussels, Belgium | https://fosdem.org/2023/schedule/track/go/ | -| GoWest Conference 2022 | 2022-10-21 | Online/ Salt Lake City, Ut USA| https://gowestconf.com | -| GopherCon | 2022-10-06-08 | Chicago | https://www.gophercon.com/ | -| GopherCon India 2022 | 2022-08-28 | Pune, India | https://gopherconindia.org | -| GopherCon Europe 2022 | 2022-07-28-31 | Berlin, Germany | https://gophercon.eu/ | -| GopherCon | 2021-12-05-08 | San Diego & Online | https://www.gophercon.com/ | -| GoWest Conference 2021 | 2021-10-22 | Online/ Salt Lake City, Ut USA| https://gowestconf.com | -| GopherCon Europe | 2021-05-26-28 | Online | https://gophercon.eu | -| O'Reilly OSS Superstream: Go | 2021-04-29 | Online | [website](https://learning.oreilly.com/attend/open-source-software-superstream-series-gogenerics-extensibility-and-the-future-of-go-in-open-source-programming/0636920053215/0636920053214)| -| GopherCon Russia 2021 Online | 2021-04-23-25 | Online | https://www.gophercon-russia.ru/en | -| | **2020** | | | | -| GopherCon Singapore 2020 | tbd due to COVID-19 | Singapore | https://2020.gophercon.sg/
CFP: https://www.papercall.io/gopherconsg-2020 | -| GopherConIndia 2020 | tbd due to COVID-19 | Goa, India | https://gopherconindia.com/
CFP: https://www.papercall.io/gci20 | -| All Systems Go | 2020-12-03 | Online | https://allsystemsgo.space -| GopherChina 2020 | 2020-11-21/22 | ShangHai, China | https://www.gopherchina.org | -| GoLab 2020 | 2020-10-19-25 | Online | https://golab.io | -| Go West Online | 2020-10-02 | Online | https://www.gowestconf.com/ | -| ~GopherCon UK~ | ~2020-08-21-23~ | ~London, UK~ | https://www.gophercon.co.uk/
CANCELLED DUE TO COVID-19 | -| GopherCon Russia 2020/2 Online | 2020-08-08-09 | Moscow, Russia | https://www.gophercon-russia.ru/en | -| GopherCon Turkey (Online) | 2020-07-25 | Istanbul, Turkey | https://gophercon.ist/ | -| GopherCon Europe | 2020-07 | Berlin, Germany | https://gophercon.berlin/ | -| GopherCon Africa 2020 | 2020-07-14-16 | Lagos, Nigeria | https://www.gophercon.africa/ | -| GoWayFest 4.0 (online edition) | 2020-07-11-12 | Minsk, Belarus | https://goway.io
CFP: https://www.papercall.io/gowayfest4 | -| GoCon Sendai | 2020-07-04| Sendai, Japan | http://sendai.gocon.jp/ | -| ~GoCon Canada~ | ~2020-05-25-26~ | ~Toronto, Canada~ | https://gocon.ca
CANCELLED DUE TO COVID-19 | -| GoWest | 2020-05-08| Salt Lake City, UT USA | https://gowestconf.com CFP: https://www.papercall.io/gowestconf | -| GoRemoteFest| 2020-04-26 | [Online](https://www.youtube.com/channel/UCUZnOzWTIeDU8kel4eNNUNw) | https://www.goremotefest.com| -| ~~EU Go Contributor Summit~~| ~~2020-04-23~~ | ~~Berlin, Germany~~ | CANCELLED DUE TO COVID-19 COVID-19 CORONAVIRUS| -| ~~dotGo~~ | ~~2020-03-30~~ | ~~Paris, France~~ | https://2020.dotgo.eu/
CANCELLED DUE TO COVID-19 COVID-19 CORONAVIRUS | -| GopherCon Russia 2020 Online | 2020-03-28 | Moscow, Russia | https://www.gophercon-russia.ru/en | -| ~~Capital Go 2020~~ | ~~2020-03-26-27~~ | ~~McLean, Virginia USA~~ | http://capitalgolang.com
CANCELLED DUE TO COVID-19 CORONAVIRUS | -| GopherCon Israel | 2020-02-03 | Tel Aviv, Israel | https://www.gophercon.org.il/ | -| Go Devroom FOSDEM | 2020-02-02 | Brussels, Belgium | https://fosdem.org/2020/schedule/track/go/ | -| GoDays | 2020-01-21-23 | Berlin, Germany | https://www.godays.io/ CFP: https://www.godays.io/cfp | -| | **2019** | | | | -| Gopherpalooza | 2019-11-07-08 | Mountain View, CA USA | http://gopherpalooza.com/ | -| GopherCon Vietnam 2019 | 2019-11-02 | Ho Chi Minh City, Vietnam | https://gophercon.vn| -| Golang Piter | 2019-11-01 | St. Petersburg, Russia | https://golangpiter.com | -| Go Conference Tokyo | 2019-10-28 | Tokyo, Japan | https://gocon.jp/ | -| GoLab 2019 | 2019-10-20-22 | Florence, Italy | https://golab.io | -| GolangConf 2019 | 2019-10-07 | Moscow, Russia | CfP: https://www.papercall.io/golangconf| -| GopherConBR 2019 | 2019-09-27-28 | Florianópolis, Brazil | http://2019.gopherconbr.org | -| OpenGo 2019 | 2019-09-23-25 | Hollywood, FL USA | https://opengo.io/ | -| GopherCon UK | 2019-08-21-23 | London, UK | https://www.gophercon.co.uk/ | -| GopherCon 2019 | 2019-07-24-27 | San Diego, CA USA | https://www.gophercon.com/ | -| GopherShip | 2019-07-20 | Moscow, Russia | https://gophership.ru | -| Go Conference '19 Summer in Fukuoka| 2019-07-13 | Fukuoka, Japan | https://fukuoka.gocon.jp/ | -| GoWayFest 3.0 | 2019-07-05 | Minsk, Belarus | https://goway.io
CFP: https://www.papercall.io/gowayfest3 | -| Gophercon Poland | 2019-06-27 | Gdansk, Poland | https://twitter.com/GopherConPL
CFP: https://eventil.com/events/GopherConPL/cfp | -| GoGoConf | 2019-06-14 | Krakow, Poland | https://www.gogoconf.rocks
CFP: https://www.papercall.io/gogoconf| -| GopherCon Europe | 2019-06-01-05-30 | Tenerife, Canary Islands, Spain | https://www.gophercon.es
CFP: https://www.papercall.io/gophercon-eu-2019| -| GoCon Canada | 2019-05-31 | Toronto, Canada | https://gocon.ca
CFP: https://www.papercall.io/goconca | -| Go Conference Tokyo | 2019-05-18 | Tokyo, Japan | https://gocon.jp/
CFP: https://www.papercall.io/gocon-tokyo-2019 | -| GopherCon Singapore 2019 | 2019-05-03 | Singapore | https://2019.gophercon.sg/
CFP: https://www.papercall.io/gopherconsg2019 | -| GopherChina 2019 | 2019-04-27 | China BeiJing | https://gopherchina.org/ | -| GopherCon Russia | 2019-04-13 | Moscow, Russia | https://www.gophercon-russia.ru/en | -| GothamGo | 2019-04-12 | New York City, NY USA | http://gothamgo.com/
CFP https://www.papercall.io/gothamgo2019 | -| CodeFest X | 2019-03-30-31 | Novosibirsk, Russia | | -| dotGo 2019 | 2019-03-25 | Paris, France | https://2019.dotgo.eu/ | -| GopherCon Israel | 2019-02-11 | Tel Aviv, Israel | https://www.gophercon.org.il/ | -| Go Devroom FOSDEM | 2019-02-02 | Brussels, Belgium | https://fosdem.org/2019/schedule/track/go/ | -| GoDays | 2019-01-30 | Berlin, Germany | https://www.godays.io/ | -| GopherCon India 2019 | 2019-01-18-19 | Goa, India | https://gopherconindia.com/ | -| | **2018** | | | | -| GopherCon Vietnam 2018 | 2018-12-08 | Ho Chi Minh City, Vietnam | http://gophercon.vn | -| Go Conference Tokyo | 2018-11-25 | Tokyo, Japan | https://gocon.connpass.com/event/109368/ | -| GoGoConf | 2018-10-25 | Krakow, Poland | https://www.gogoconf.rocks | -| GoLab 2018 | 2018-10-22-23 | Florence, Italy | https://golab.io | -| Gopherpalooza 2018 | 2018-10-12 | San Francisco, CA | http://gopherpalooza.com/ | -| Go Stockholm Conference | 2018-10-06 | Stockholm, Sweden | https://www.eventbrite.com/e/go-stockholm-conference-tickets-49325007425 | -| GoWayFest 2.0 | 2018-09-28 | Minsk, Belarus | https://goway.io | -| GopherCon Brasil 2018 | 2018-09-27-29 | Florianópolis, Brazil | https://2018.gopherconbr.org/en
CFP https://www.papercall.io/gopherconbrasil2018 | -| GopherCon Denver 2018 | 2018-08-27-30 | Denver, CO | https://www.gophercon.com/
Talks: https://www.youtube.com/playlist?list=PL2ntRZ1ySWBdatAqf-2_125H4sGzaWngM
Lightning Talks: https://www.youtube.com/playlist?list=PL2ntRZ1ySWBdMEZScpaoRX-vyt6pRUvfM | -| GopherCon UK 2018 | 2018-08-01-03 | London, UK | https://www.gophercon.co.uk/ | -| Go Northwest 2018 | 2018-07-30 | Seattle, WA, USA | http://gonorthwest.io/ | -| GopherCon Europe - Iceland | 2018-06-01-02 | Reykjavik, Iceland | [Talks](https://www.youtube.com/playlist?list=PLtoVuM73AmsJuBoOoI-12WR36nhvtlJ-A&disable_polymer=true)
[Website](https://gophercon.is) | -| GopherCon SG 2018 | 2018-05-04 | Singapore | https://2018.gophercon.sg/ | -| GothamGo 2018 | 2018-04-27 | New York, USA | http://gothamgo.com/ | -| Go Conference Tokyo | 2018-04-15 | Tokyo, Japan | https://gocon.connpass.com/event/82515/ | -| GopherCon China 2018 | 2018-04-14-15 | Shanghai, China | http://www.gopherchina.org/ | -| GopherCon Russia 2018 | 2018-03-17 | Moscow, Russia | http://gophercon-russia.ru/en
https://github.com/GopherConRu/talks | -| GopherCon India 2018 | 2018-03-09-10 | Pune, India | http://www.gophercon.in/ | -| Go Devroom FOSDEM 2018 | 2018-02-03-04 | Brussels, Belgium | https://fosdem.org/2018/schedule/track/go/ | -| | **2017** | | | | -| GopherCon Brasil 2017 | 2017-11-17-19 | Florianópolis, Brazil | https://2017.gopherconbr.org/en | -| dotGo | 2017-11-06 | Paris, France | https://www.dotgo.eu | -| Go Conference Tokyo | 2017-11-05 | Tokyo, Japan | https://gocon.connpass.com/event/66615/ | -| GothamGo | 2017-10-05-06 | New York, USA | http://gothamgo.com/ | -| Golang UK | 2017-08-16-18 | London, UK | https://golanguk.com | -| GopherCon Denver | 2017-07-12-15 | Denver, CO | http://gophercon.com | -| GopherCon Singapore 2017 | 2017-05-25-26 | Singapore | https://2017.gophercon.sg | -| Capital Go Language Conference | 2017-04-24-25 | Washington, DC | http://www.capitalgolang.com/ | -| GopherChina 2017 | 2017-04-15-16 | Shanghai | http://www.bagevent.com/event/357764 | -| Go Conference Tokyo | 2017-03-25 | Tokyo, Japan |https://gocon.connpass.com/event/52441/ | -| GopherCon India 2017 | 2017-02-24-25 | Pune, India | http://www.gophercon.in/ -| Go Devroom FOSDEM | 2017-02-05 | Brussels, Belgium | https://fosdem.org/2017/schedule/track/go/ | -| GoLab | 2017-01-20-21 | Florence, Italy | http://golab.io | -| | **2016** | | | | -| GothamGo | 2016-11-18 | New York, USA | http://gothamgo.com/ | -| GopherCon Brasil | 2016-11-04-05 | Florianópolis, Brazil | https://2016.gopherconbr.org/en/ | -| dotGo | 2016-10-10 | Paris, France | http://2016.dotgo.eu | -| Golang UK | 2016-08-18 | London, UK | http://golanguk.com | -| GopherCon Denver | 2016-07-11 | Denver, CO | http://gophercon.com | -| Gopherfest | 2016-05-16 | San Francisco, USA | http://www.gopherfest.org/ | -| Go Conference Tokyo | 2016-04-23 | Tokyo, Japan | http://gocon.connpass.com/event/27521/ | -| Gopher China | 2016-04-16 | Beijing, China | http://www.gopherchina.org | -| GopherCon Dubai | 2016-02-23 | Dubai, UAE | http://www.gophercon.ae | -| GopherCon India | 2016-02-19 | Bengaluru, India | [videos](https://www.youtube.com/watch?v=4Dr8FXs9aJM&list=PLxFC1MYuNgJT_ynbXGuYAZbSnUnq-6VQA) | -| FOSDEM | 2016-01-30 | Brussels, Belgium | https://video.fosdem.org/2016/h1302/ | -| Gopher Gala | 2016-01-22 | Earth | | -| | **2015** | | | -| GoLab | 2015-12-15 | Florence, Italy | http://golab.io | -| Go Conference Tokyo | 2015-12-06 | Tokyo, Japan | https://gocon.connpass.com/event/22930/ | -| GopherFest SV | 2015-11-18 | Facebook, Menlo Park, CA | [videos](https://www.youtube.com/playlist?list=PLtLJO5JKE5YALxdnGgvgwxTSmANOvyAo9) | -| dotGo | 2015-11-09 | Paris, France | [videos](https://www.youtube.com/playlist?list=PLMWwKlp9xoYX4mlNDdkCOfsUG_40WCMCX) | -| GothamGo | 2015-10-02 | NY, NY | [videos](https://www.youtube.com/playlist?list=PLeGxIOPLk9ELh9tsPZMzau6CzMjfMzp9-) | -| GolangUK | 2015-08-21 | London, UK | [videos](https://www.youtube.com/playlist?list=PLDWZ5uzn69ezRJYeWxYNRMYebvf8DerHd) | -| GopherCon Denver | 2015-07-07 | Denver, CO | [keynotes](https://www.youtube.com/playlist?list=PL2ntRZ1ySWBf-_z-gHCOR2N156Nw930Hm), [lightning](https://www.youtube.com/playlist?list=PL2ntRZ1ySWBeHqlHM8DmvS8axgbrpvF9b) | -| Go Conference Tokyo | 2015-06-20 | Tokyo, Japan | https://gocon.connpass.com/event/14063/ | -| GopherfestSF | 2015-06-25 | San Francisco, CA | [videos](https://www.youtube.com/playlist?list=PLtLJO5JKE5YB55ExLApKU0S8_eN5eaGkU) | -| GopherCon India | 2015-03-17 | Bengaluru, India | [videos](https://www.youtube.com/playlist?list=PLxFC1MYuNgJTY3uQ5Ja4F5Sz305nnrBOq) | -| Go Devroom FOSDEM | 2015-03-04 | Brussels, Belgium | [videos](https://www.youtube.com/playlist?list=PLtLJO5JKE5YDK74RZm67xfwaDgeCj7oqb) | -| Gopher China | 2015-04-25 | Shanghai, China | | -| London Go Gathering | 2015-02-03 | London, UK | [videos](https://www.youtube.com/playlist?list=PLtLJO5JKE5YCZYDAt8-uyJbVgq1FIUpVM)| -| | **2014** | | | -| Go Conference Tokyo | 2014-11-30 | Tokyo, Japan | https://gocon.connpass.com/event/9748/ | -| GothamGo | 2014-11-15 | NYC, NY | [videos](https://vimeo.com/channels/852217) | -| dotGo | 2014-09-10 | Paris, France | [videos](https://www.youtube.com/playlist?list=PLMW8Xq7bXrG58Qk-9QSy2HRh2WVeIrs7e) | -| Go Devroom FOSDEM | 2014-06-30 |Brussels, Belgium | [videos](https://www.youtube.com/playlist?list=PLtLJO5JKE5YDKG4WcaNts3IVZqhDmmuBH) | -| Go Conference Tokyo | 2014-05-31 | Tokyo, Japan | https://gocon.connpass.com/event/6370/ | -| GopherCon Denver | 2014-04-24 | Denver, CO | [videos](https://www.youtube.com/playlist?list=PL2ntRZ1ySWBcD_BiJiDJUcyrb2w3bTulF) | -| | **2013** | | | -| Go Conference Tokyo | 2013-10-14 | Tokyo, Japan | https://gocon.connpass.com/event/3510/ | -| Go Conference Tokyo | 2013-04-13 | Tokyo, Japan | https://gocon.connpass.com/event/1906/ | diff --git a/Configuring-GoLand-for-WebAssembly.md b/Configuring-GoLand-for-WebAssembly.md index b54e8b62..59b4a2dc 100644 --- a/Configuring-GoLand-for-WebAssembly.md +++ b/Configuring-GoLand-for-WebAssembly.md @@ -1,51 +1,4 @@ -### [← Back](https://github.com/golang/go/wiki/WebAssembly) to the main WebAssembly page. +The Go wiki on GitHub has moved to go.dev (#61940). -# Configuring GoLand for WebAssembly (Wasm) projects +Try or . -## Initial project configuration - -When you first open or start a WebAssembly project in GoLand, it won't understand the "*syscall/js*" package. - -That's easily fixable, by changing the **GOOS** and **GOARCH** values in the project settings, as per the screenshots below. - -![GoLand Wasm Setup pic1](https://github.com/leitzler/wasmWikiPics/raw/master/png/Golang-Wasm-Setup1.png) - -**Note** - The screenshot below shows how to access **Settings** on a Linux desktop. If you're using macOS, you'll probably need to access them through the standard macOS **Preferences** option. -![GoLand Wasm Setup pic2](https://github.com/leitzler/wasmWikiPics/raw/master/png/Golang-Wasm-Setup2.png) - -![GoLand Wasm Setup pic3](https://github.com/leitzler/wasmWikiPics/raw/master/png/Golang-Wasm-Setup3.png) - -![GoLand Wasm Setup pic4](https://github.com/leitzler/wasmWikiPics/raw/master/png/Golang-Wasm-Setup4.png) - - -## Configuring Run/Debug settings - -With the initial project settings changed, you'll probably want to configure the Run/Debug settings next. - -That will let you recompile the .wasm file by just launching `Run` (Shift+F10 on Linux). - -![GoLand Wasm Build pic2](https://github.com/leitzler/wasmWikiPics/raw/master/png/Golang-Wasm-Build2.png) - -![GoLand Wasm Build pic3](https://github.com/leitzler/wasmWikiPics/raw/master/png/Golang-Wasm-Build3.png) - -![GoLand Wasm Build pic4](https://github.com/leitzler/wasmWikiPics/raw/master/png/Golang-Wasm-Build4.png) - -![GoLand Wasm Build pic5](https://github.com/leitzler/wasmWikiPics/raw/master/png/Golang-Wasm-Build5.png) - -![GoLand Wasm Build pic6](https://github.com/leitzler/wasmWikiPics/raw/master/png/Golang-Wasm-Build6.png) - -![GoLand Wasm Build pic7](https://github.com/leitzler/wasmWikiPics/raw/master/png/Golang-Wasm-Build7.png) - -![GoLand Wasm Build pic8](https://github.com/leitzler/wasmWikiPics/raw/master/png/Golang-Wasm-Build8.png) - -![GoLand Wasm Build pic9](https://github.com/leitzler/wasmWikiPics/raw/master/png/Golang-Wasm-Build9.png) - -![GoLand Wasm Build pic10](https://github.com/leitzler/wasmWikiPics/raw/master/png/Golang-Wasm-Build10.png) - -![GoLand Wasm Build pic11](https://github.com/leitzler/wasmWikiPics/raw/master/png/Golang-Wasm-Build11.png) - -![GoLand Wasm Build pic12](https://github.com/leitzler/wasmWikiPics/raw/master/png/Golang-Wasm-Build12.png) - -Finished, your GoLand setup should now be complete. - -### [← Back](https://github.com/golang/go/wiki/WebAssembly) to the main WebAssembly page. \ No newline at end of file diff --git a/Contributing-to-gopls.md b/Contributing-to-gopls.md index c6640033..ca64c70b 100644 --- a/Contributing-to-gopls.md +++ b/Contributing-to-gopls.md @@ -1,5 +1,4 @@ ---- -> This page has been subsumed into the [committed markdown](https://github.com/golang/tools/blob/master/gopls/doc/contributing.md) of x/tools repository -> -> Please do not edit this page! ---- +The Go wiki on GitHub has moved to go.dev (#61940). + +Try or . + diff --git a/CoreDumpDebugging.md b/CoreDumpDebugging.md index de663c70..6d096181 100644 --- a/CoreDumpDebugging.md +++ b/CoreDumpDebugging.md @@ -1,150 +1,4 @@ -Originally published at https://rakyll.org/coredumps/. +The Go wiki on GitHub has moved to go.dev (#61940). ---- +Try or . - -Debugging is highly useful to examine the execution flow -and to understand the current state of a program. - -A core file is a file that contains the memory dump of a running -process and its process status. It is primarily used for post-mortem -debugging of a program, as well as to understand a program's state -while it is still running. These two cases make debugging of core dumps -a good diagnostics aid to postmortem and analyze production -services. - -I will use a simple hello world web server in this article, -but in real life our programs might get very -complicated easily. -The availability of core dump analysis gives you an -opportunity to resurrect a program from specific snapshot -and look into cases that might only reproducible in certain -conditions/environments. - -__Note__: This flow only works on Linux at this point end-to-end, -I am not quite sure about the other Unixes but it is not -yet supported on macOS. Windows is not supported at this point. - -Before we begin, you need to make sure that your ulimit -for core dumps are at a reasonable level. It is by default -0 which means the max core file size can only be zero. -I usually set it to unlimited on my development machine by typing: - -``` -$ ulimit -c unlimited -``` - -Then, make sure you have [delve](https://github.com/derekparker/delve) -installed on your machine. - -Here is a `main.go` that contains a simple handler and it starts an HTTP server. - -``` -$ cat main.go -package main - -import ( - "fmt" - "log" - "net/http" -) - -func main() { - http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprint(w, "hello world\n") - }) - log.Fatal(http.ListenAndServe("localhost:7777", nil)) -} -``` - -Let's build this and have a binary. - -``` -$ go build . -``` - -Let’s assume, in the future, there is something messy going on with -this server but you are not so sure about what it might be. -You might have instrumented your program in various ways but it -might not be enough for getting any clue from the existing -instrumentation data. - -Basically, in a situation like this, it would be nice to have a -snapshot of the current process, and then use that snapshot to dive -into to the current state of your program with your existing debugging -tools. - -There are several ways to obtain a core file. You might have been -already familiar with crash dumps, these are basically core dumps -written to disk when a program is crashing. Go doesn't enable crash dumps -by default but gives you this option on Ctrl+backslash when -`GOTRACEBACK` env variable is set to "crash". - -``` -$ GOTRACEBACK=crash ./hello -(Ctrl+\) -``` - -It will crash the program with stack trace printed and core dump file -will be written. - -Another option is to retrieve a core dump from a running process -without having to kill a process. -With `gcore`, it is possible to get the core -files without crashing. Let’s start the server again: - -``` -$ ./hello & -$ gcore 546 # 546 is the PID of hello. -``` -We have a dump without crashing the process. The next step -is to load the core file to delve and start analyzing. - -``` -$ dlv core ./hello core.546 -``` - -Alright, this is it! This is no different than the typical delve interactive. -You can backtrace, list, see variables, and more. Some features will be disabled -given a core dump is a snapshot and not a currently running process, but -the execution flow and the program state will be entirely accessible. - -``` -(dlv) bt - 0 0x0000000000457774 in runtime.raise - at /usr/lib/go/src/runtime/sys_linux_amd64.s:110 - 1 0x000000000043f7fb in runtime.dieFromSignal - at /usr/lib/go/src/runtime/signal_unix.go:323 - 2 0x000000000043f9a1 in runtime.crash - at /usr/lib/go/src/runtime/signal_unix.go:409 - 3 0x000000000043e982 in runtime.sighandler - at /usr/lib/go/src/runtime/signal_sighandler.go:129 - 4 0x000000000043f2d1 in runtime.sigtrampgo - at /usr/lib/go/src/runtime/signal_unix.go:257 - 5 0x00000000004579d3 in runtime.sigtramp - at /usr/lib/go/src/runtime/sys_linux_amd64.s:262 - 6 0x00007ff68afec330 in (nil) - at :0 - 7 0x000000000040f2d6 in runtime.notetsleep - at /usr/lib/go/src/runtime/lock_futex.go:209 - 8 0x0000000000435be5 in runtime.sysmon - at /usr/lib/go/src/runtime/proc.go:3866 - 9 0x000000000042ee2e in runtime.mstart1 - at /usr/lib/go/src/runtime/proc.go:1182 -10 0x000000000042ed04 in runtime.mstart - at /usr/lib/go/src/runtime/proc.go:1152 - -(dlv) ls -> runtime.raise() /usr/lib/go/src/runtime/sys_linux_amd64.s:110 (PC: 0x457774) - 105: SYSCALL - 106: MOVL AX, DI // arg 1 tid - 107: MOVL sig+0(FP), SI // arg 2 - 108: MOVL $200, AX // syscall - tkill - 109: SYSCALL -=> 110: RET - 111: - 112: TEXT runtime·raiseproc(SB),NOSPLIT,$0 - 113: MOVL $39, AX // syscall - getpid - 114: SYSCALL - 115: MOVL AX, DI // arg 1 pid -``` \ No newline at end of file diff --git a/Courses.md b/Courses.md index 8c0984e7..c3362b67 100644 --- a/Courses.md +++ b/Courses.md @@ -1,86 +1,4 @@ -# Introduction +The Go wiki on GitHub has moved to go.dev (#61940). -Go is a great language for CS majors. This page presents some university courses that use Go. For a list of free and commercial Go training classes, see [the Learn wiki](Learn). +Try or . -# Language - - * University of Helsinki, Department of Computer Science used to have a course named Introduction to Go, taught by K. Bäckman: http://www.cs.helsinki.fi/courses/582336 in Spring 2010. - * University of Sofia "St. Kliment Ohridski", Faculty of Mathematics and Informatics has elective course named "Programming with Go", taught by K. Vladimiroff: http://fmi.golang.bg (bulgarian) and their [[public lectures](https://github.com/fmi/go-lectures)] - (also in bulgarian) - * Free University of Berlin (Germany) had a course [Introduction to Go Programming](http://w3.inf.fu-berlin.de/lehre/WS12/go/) in Spring 2013. - * J.W. Goethe University (Frankfurt/Main, Germany) had a course [Introduction to Go Programming](http://www.sepl.informatik.uni-frankfurt.de/2014-ws/b-ps2/index.de.html) in Spring 2015 (in german) - * University of Pennsylvania had a course on [Go Programming](https://www.seas.upenn.edu/~cis193/) in Spring 2017. - * SUNY Potsdam (Potsdam, NY) "Selected languages course with Go", taught by Dr. Brian C. Ladd (Associate Professor of Computer Science). First class in Spring 2017 - * University of Milan has a course named "Computer Programming" taught by Paolo Boldi: http://boldi.di.unimi.it/Corsi/Inf2018/ - * University of Zagreb (Croatia), Faculty of Electrical Engineering and Computing, has an ongoing course [Go programming language](https://www.fer.unizg.hr/en/course/gpl) since 2020, held by Z. Bratković and B. Banelli. Videos available from academic year [2019./2020.](https://www.youtube.com/watch?v=mq18_oSNkHE&list=PLDG0WuJlyEw3GuJ4FAoP-ea8PCsU5J-9K&pp=iAQB) and [2020./2021.](https://www.youtube.com/watch?v=Ms_5seF6Smg&list=PLDG0WuJlyEw1o7cQ7Raf_SHgak4G57zCW&pp=iAQB) (Croatian) - - -# Programming Concepts - - * President University (Cikarang, West Java, Indonesia) had a course [Programming Concepts](http://president.ac.id/study/undergraduate/school-of-computer-science/information-technology) for every junior students (using C, Go and Javascript). - -# Web - - * CS 4830: Science and Engineering of the WWW taught by Ryanne Dolan at University of Missouri: http://4830.ryannedolan.info/ - * CSCI 130: Web Programming taught by [Todd McLeod](https://www.udemy.com/user/toddmcleod/) at California State University Fresno - * CSCI 194: Adv. Web Programming taught by [Todd McLeod](https://www.udemy.com/user/toddmcleod/) at California State University Fresno - * CIT 90: Data Drive Websites taught by [Todd McLeod](https://www.udemy.com/user/toddmcleod/) at Fresno City College - * CIT 94: Server Side Scripting taught by [Todd McLeod](https://www.udemy.com/user/toddmcleod/) at Fresno City College - -# Concurrency - - * Go is being used at the end of a yearlong freshman computer science class at KTH: http://yourbasic.org/golang/concurrent-programming/ - - * Go, Concurrent and Systems Programming from Rochester Institute of Technology: http://www.cs.rit.edu/~ats/go-2011-2/index.xml - - * Free University of Berlin (Germany) had a course on [Concurrent Programming](http://w3.inf.fu-berlin.de/lehre/SS13/alp4/) with Go as a reference language in 2013. - - * University of Duisburg-Essen (Germany) had a lecture about Go and CSP within their course on [Concurrent systems modelling](http://www.ti.inf.uni-due.de/teaching/ss2014/mod_ns/) in summer 2014. [[Slides](http://www.ti.inf.uni-due.de/fileadmin/public/teaching/mod_ns/folien/SS2014/google-go-2x2.pdf)] - - * University of Stavanger, Norway. We use Go to teach concurrency principles in DAT320 Operating Systems. http://www.uis.no/studies/study-courses/?code=DAT320_1&parentcat=9835 - - * University of Tromsø, Norway. [Concurrent and Data-Intensive Programming (INF-2200)](https://uit-inf-2202-f16.github.io/). - - * University of Victoria (Canada) used Go in the section on Concurrency as a part of [Programming Languages (CSC 330)](https://heat.csc.uvic.ca/coview/course/2017091/CSC330) - -# Distributed Computing - - * Distributed Computer Systems (CS 138) at Brown: http://cs.brown.edu/courses/cs138/s16/syllabus.html - - * Distributed Systems course (COS 418) at Princeton: https://www.cs.princeton.edu/courses/archive/fall16/cos418/ - - * Distributed Systems course (15-440) at CMU: http://www.cs.cmu.edu/~dga/15-440/F12/index.html (see also http://da-data.blogspot.se/2013/02/teaching-distributed-systems-in-go.html) - - * 6.824 Distributed Systems at MIT is using Go in its labs: http://pdos.csail.mit.edu/6.824/. - - * CSE 223B, Spring 2014: Distributed Computing and Systems at UC San Diego http://cseweb.ucsd.edu/classes/sp14/cse223B-a/index.html - - * Dixie State University teaches Go in an introductory course to programming languages and later on in distributed systems. - - * CS 352, Computer Organization and Design, at the University of Wisconsin, Eau Claire: http://cs.uwec.edu/~buipj/teaching/cs.352.f13/lab_01_high_performance_computing.html - - * KTH Stockholm uses Go to teach concurrency: DD1396 Parallel and Concurrent Programming. https://www.kth.se/student/kurser/kurs/DD1396 - - * Norwegian University of Science and Technology: TTK4145 Real-Time Programming http://www.itk.ntnu.no/fag/TTK4145/information/ - - * University of Stavanger, Norway. We use Go to build a replicated state machine based on Paxos in DAT520 Distributed Systems. http://www.uis.no/studies/study-courses/?code=DAT520_1&parentcat=9835 - - * Moscow State University, Russia. Go is used in graduate course on "Selected Topics in Distributed Systems Engineering" - - * D7024E - Mobile and Distributed Computing Systems at Luleå University of Technology. Go is used to implement the DHT algorithm Chord and create a data replication system. http://www.ltu.se/edu/course/D70/D7024E/D7024E-Mobila-och-distribuerade-datorsystem-1.67844?l=en&kursView=kursplan - - * University of Tromsø, Norway. [Distributed Systems Fundamentals (INF-3200)](https://uit.no/education/courses/course?p_document_id=291961) and [Advanced Distributed Systems (INF-3203)](https://uit.no/education/courses/course?p_document_id=292883). - -# Networking - - * Computer Networking (COS 461) at Princeton: http://www.cs.princeton.edu/courses/archive/spring16/cos461/ (See Assignment 1 https://github.com/PrincetonUniversity/COS461-Spring2016/tree/master/notebook/assignment1 and Assignment 4 http://www.cs.princeton.edu/courses/archive/spring16/cos461/assignments/. - -# Compiler Design - - * Compiler Design (CS712/CS812) at the University of New Hampshire: http://www.cs.unh.edu/~cs712/. In Fall 2016 we are compiling a subset of Go to LLVM code. - - * Introduction to Compilers (6197, Spanish) at Rey Juan Carlos University of Madrid: http://lsub.org/comp. Students write a compiler in Go that implements a language for drawing graphics. - -# Security - - * [Learn Cryptography in Go](https://boot.dev/learn/learn-cryptography) on Boot.dev. A code-in-the-browser course where cryptography principles are taught in the Go language. - * [Computer Systems Security](https://cs.brown.edu/courses/cs166/) (CS166) At Brown University. In particular, the final [Dropbox Project](https://cs.brown.edu/courses/cs166/files/assignments/dropbox.pdf). diff --git a/CreatingSubRepository.md b/CreatingSubRepository.md index c5c0276d..15f0e928 100644 --- a/CreatingSubRepository.md +++ b/CreatingSubRepository.md @@ -1,26 +1,4 @@ -This page outlines the steps that need to be done to create a new golang.org/x repository, in order for it to have the same properties as all existing golang.org/x repositories: -- a golang.org/x redirect -- automatic git mirroring from Gerrit to GitHub -- automatic importing of GitHub PRs into Gerrit CLs +The Go wiki on GitHub has moved to go.dev (#61940). -## Steps +Try or . -1. Create a new empty Gerrit repository at https://go.googlesource.com, complete with a description. - - Create an initial commit with `LICENSE`, `PATENTS`, `CONTRIBUTING.md`, and `README.md` files and push it directly to the Gerrit repository. See [example commit](https://go.googlesource.com/govulncheck-action/+/a197ae39e55573b3a0e752b9bd72f457a458adf6). - - See the internal team instructions at go/go-gerrit#new-repository for how to create a repository. -2. Create a [new empty GitHub repository](https://github.com/organizations/golang/repositories/new) at https://github.com/golang with the same name and description. - - Turn off Wikis, Issues, Projects in repository settings. - - On "Manage access" tab: - - Add "golang org admins" team with Admin access. - - Add "gophers" team with Write access. - - Add "robots" team with Write access (can only be done by a maintainer of golang organization; ask someone else if you're not). -3. Modify the `x/build/repos` package. -4. Update x/website's version of x/build to include modified `x/build/repos` package. -5. Redeploy all affected commands (or ask an x/build [owner](https://dev.golang.org/owners) to deploy if you're not; the order shouldn't matter): - 1. `x/build/cmd/gitmirror` - 2. `x/build/maintner/maintnerd` - - Note that it's expected for the new repo not to appear in maintner until first issue or PR is created (see [#25744](https://go.dev/issue/25744)). - 3. `x/build/cmd/gerritbot` - 4. `x/build/cmd/coordinator` - 5. `x/website/cmd/golangorg` -6. You're done. \ No newline at end of file diff --git a/CustomPprofProfiles.md b/CustomPprofProfiles.md index 5fe95ef0..18d24ca4 100644 --- a/CustomPprofProfiles.md +++ b/CustomPprofProfiles.md @@ -1,99 +1,4 @@ -Originally published at https://rakyll.org/custom-profiles/. +The Go wiki on GitHub has moved to go.dev (#61940). ----- +Try or . -Go provides several pprof profiles out of the box to gather -profiling data from Go programs. - -The builtin profiles provided by the [runtime/pprof](https://pkg.go.dev/runtime/pprof/) package: - -* **profile**: CPU profile determines where a program spends its time while actively consuming CPU cycles (as opposed while sleeping or waiting for I/O). -* **heap**: Heap profile reports the currently live allocations; used to monitor current memory usage or check for memory leaks. -* **threadcreate**: Thread creation profile reports the sections of the program that lead the creation of new OS threads. -* **goroutine**: Goroutine profile report the stack traces of all current goroutines. -* **block**: Block profile show where goroutines block waiting on synchronization primitives (including timer channels). Block profile is not enabled by default; use runtime.SetBlockProfileRate to enable it. -* **mutex**: Mutex profile reports the lock contentions. When you think your CPU is not fully utilized due to a mutex contention, use this profile. Mutex profile is not enabled by default, see runtime.SetMutexProfileFraction to enable. - -Additional to the builtin profiles, [runtime/pprof](https://pkg.go.dev/runtime/pprof/) package allows you to export your custom profiles, and instrument your code to record -execution stacks that contributes to this profile. - -Imagine we have a blob server, and we are writing a Go client for it. And our users want to be able to profile the opened blobs on the client. We can create a profile and record the events of blob opening and closing, so the user can tell how many open blobs they are at any time. - -Here is a blobstore package that allows you to open some blobs. We will create a new custom profile and start -recording execution stacks that contributes to opening of blobs: - -``` go -package blobstore - -import "runtime/pprof" - -var openBlobProfile = pprof.NewProfile("blobstore.Open") - -// Open opens a blob, all opened blobs need -// to be closed when no longer in use. -func Open(name string) (*Blob, error) { - blob := &Blob{name: name} - // TODO: Initialize the blob... - - openBlobProfile.Add(blob, 2) // add the current execution stack to the profile - return blob, nil -} -``` - -And once users want to close the blob, we need to remove the execution stack associated with the current blob from the profile: - -```go -// Close closes the blob and frees the -// underlying resources. -func (b *Blob) Close() error { - // TODO: Free other resources. - openBlobProfile.Remove(b) - return nil -} -``` - -And now, from the programs using this package, we should be able to retrieve `blobstore.Open` profile data and use our daily pprof tools to examine and visualize them. - -Let's write a small main program than opens some blobs: - -``` -package main - -import ( - "fmt" - "math/rand" - "net/http" - _ "net/http/pprof" // as a side effect, registers the pprof endpoints. - "time" - - "myproject.org/blobstore" -) - -func main() { - for i := 0; i < 1000; i++ { - name := fmt.Sprintf("task-blob-%d", i) - go func() { - b, err := blobstore.Open(name) - if err != nil { - // TODO: Handle error. - } - defer b.Close() - - // TODO: Perform some work, write to the blob. - }() - } - http.ListenAndServe("localhost:8888", nil) -} -``` - -Start the server, then use go tool to read and visualize the profile data: - -``` -$ go tool pprof http://localhost:8888/debug/pprof/blobstore.Open -(pprof) top -Showing nodes accounting for 800, 100% of 800 total - flat flat% sum% cum cum% - 800 100% 100% 800 100% main.main.func1 /Users/jbd/src/hello/main.go -``` - -You will see that there are 800 open blobs and all openings are coming from main.main.func1. In this small example, there is nothing more to see, but in a complex server you can examine the hottest spots that works with an open blob and find out bottlenecks or leaks. \ No newline at end of file diff --git a/Darwin.md b/Darwin.md index 1970cbf1..11552a55 100644 --- a/Darwin.md +++ b/Darwin.md @@ -1,21 +1,4 @@ -# Go on Darwin +The Go wiki on GitHub has moved to go.dev (#61940). -| **Kernel version** | **Distributions** | **Architectures** | **Initial support version** | **Final support version** | -|:-------------------|:--------------------------------|:-----------------------|:---------------|:----------| -| 18 | macOS Mojave 10.14, iOS 12 | amd64, arm64, 386 | Go 1.12 | | -| 17 | macOS High Sierra 10.13, iOS 11 | amd64, arm64, 386 | Go 1.7.1 _***_ | | -| 16 | macOS Sierra 10.12, iOS 10 | amd64, arm, arm64, 386 | Go 1.7.1 _**_ | | -| 15 | OS X El Capitan 10.11 | amd64, 386 | Go 1 _*_ | | -| 15 | iOS 9 | arm, arm64 | Go 1.5 | | -| 14 | OS X Yosemite 10.10 | amd64, 386 | Go 1 _*_ | | -| 14 | iOS 7, iOS 8 | arm, arm64 | Go 1.5 | | -| 13 | OS X Mavericks 10.9 | amd64, 386 | Go 1 _*_ | Go 1.10.8 | -| 12 | OS X Mountain Lion 10.8 | amd64, 386 | Go 1 _*_ | Go 1.10.8 | -| 11 | OS X Lion 10.7 | amd64, 386 | Go 1 _*_ | Go 1.7.6 | -| 10 | Mac OS X Snow Leopard 10.6 | amd64, 386 | Go 1 | Go 1.4.3 | +Try or . -_*_ Go 1.5 or above is recommended. - -_**_ See https://github.com/golang/go/issues/16570 and https://github.com/golang/go/issues/19772. - -_***_ See https://github.com/golang/go/issues/22037. \ No newline at end of file diff --git a/DashboardBuilders.md b/DashboardBuilders.md index 3c549c8a..2f01dba1 100644 --- a/DashboardBuilders.md +++ b/DashboardBuilders.md @@ -1,105 +1,4 @@ -# Table of contents -1. [Coordinator Builders](#coordinator-builders) - 1. [How to set up a builder](#how-to-set-up-a-builder) - 1. [Builder Requirements](#builder-requirements) - 1. [Security notes](#security-notes) -2. [LUCI Builders](#luci-builders) - 1. [How to set up a builder](#how-to-set-up-a-builder-1) - 1. [Builder Requirements](#builder-requirements-1) - -# Coordinator Builders - -Build configs (at the top) and host configs (bottom) are listed here: - -https://farmer.golang.org/builders - -A builder runs on a certain host type. (e.g. `linux-386-387` is a build type. It runs on `host-linux-kubestd`, a Kubernetes-based linux/amd64 host) - -They come from the file https://github.com/golang/build/blob/master/dashboard/builders.go - -For design details about the coordinator, see https://go.dev/s/builderplan - -Information about builder machines, how many are running and their status can be found at https://farmer.golang.org/ - -## How to set up a builder - - 1. Talk to golang-dev@ to get a builder host type & hash (they can get one from using the `golang.org/x/build/cmd/genbuilderkey` tool), and put that in ` ~/.gobuildkey` or `~/.gobuildkey-host-foo-bar` or the file pointed to by env var `$GO_BUILD_KEY_PATH`. - 1. Define your new builder in https://github.com/golang/build/blob/master/dashboard/builders.go with a new HostConfig and BuildConfig. - 1. Have golang-dev deploy the build coordinator rebuilt with the dashboard/builders.go change - 1. Have golang-dev modify golang.org/x/build/cmd/buildlet/Makefile to add your port and to uploads its buildlet binary to Google Cloud Storage (you can do this step out of order if your compiler changes aren't yet upstream) - 1. Verify you can see the new host & build configs at https://farmer.golang.org/builders - 1. (Interm/testing step) Test that your builder key works and you can register: - 1. `go get -u golang.org/x/build/cmd/buildlet` - 1. `buildlet -coordinator=farmer.golang.org -reverse-type=host-foo-bar -reboot=false` - 1. verify it shows up at https://farmer.golang.org/#pools in "Reverse pool summary" and "Reverse pool machine detail" - 1. Modify the golang.org/x/build/cmd/buildlet/stage0 binary if/as needed to pass the right flags to the buildlet binary. - 1. Put your stage0 binary on your builder, run in a loop under your operating system's process supervisor (systemd, etc). The stage0 binary is responsible for conditionally re-downloading the buildlet binary from Google Cloud Storage for each build. (This lets us evolve the build system without involving each machine owner) - -For WIP ports, the steps above can be done out of order as needed. But as a port matures, be sure each step above is done. In particular, make sure that you're not just running a fixed copy of the buildlet binary in a loop forever. We need to be able to update it over time without your involvement. You should be running the stage0 binary (or equivalent shell script or similar for your platform) in a loop instead. - -## Builder Requirements - * Internet connection (at least be able to access Google and https://farmer.golang.org) - * Preferably two or more (V)CPUs - * At least 512MiB of memory (1GB or more highly recommended. 512MB might need a small `GOGC` setting to avoid thrashing.) - -## Security notes - -Generally, community-run builders only run code that's already been reviewed & submitted. We only enable pre-submit testing for builders run by the Go team that have a lot of hardware available. However, the [Gomote tool](https://go.dev/wiki/Gomote) is available for a number of people on the Go team and in the Go community that lets them have arbitrary access to the builders for development & debugging. - -For paranoia reasons, you might want to run your builder in an isolated network that can't access any of your internal resources. - -# LUCI Builders - -The Go team is migrating the testing pipeline from a custom solution, the coordinator, to [LUCI](https://chromium.googlesource.com/chromium/src/+/master/docs/tour_of_luci_ui.md). [LUCI](https://chromium.googlesource.com/chromium/src/+/master/docs/tour_of_luci_ui.md) is an open source continuous integration system created by the Chrome open source team at Google. The Go team has adopted the use of LUCI in order to leverage a continuous integration solution which is used and supported by a larger group of developers. This should enable the team to provide a more featureful solution to the community. - -The LUCI system requires builders to run two applications which authenticate to LUCI and receive and process builds. LUCI token daemon generates a token needed to authenticate. The swarming bot uses the token to connect to LUCI and process builds. - -## Builder Requirements - - * An internet connection with the ability to connect to: - - https://proxy.golang.org (or an alternative proxy via GOPROXY). - - https://luci-token-server.appspot.com - - https://chromium-swarm.appspot.com - - https://cr-buildbucket.appspot.com - - https://7419-34ac013-dot-chromium-swarm.appspot.com (possible changed in the future?) - - https://remotebuildexecution.googleapis.com - * Resources - - At least 512MB of memory. 1GB or more is highly recommended. - - 20GB disk space is ideal. - - Preferably with 2 or more (V)CPUs. - * Python3 installed and in the `PATH`. - * Permissions - - The bot should be run as the `swarming` user (without root rights). - - The bot automatically updates itself. It should have permissions to do so. - - The bot periodically restarts the machine. It should have permissions to do so (via sudo). - - Under Docker, you can replace the shutdown command with a [shell script that restarts the container](https://chromium.googlesource.com/infra/infra/+/main/docker/swarm_docker/README.md#shutting-container-down-from-within) ([example](https://cs.opensource.google/go/x/build/+/master:cmd/buildlet/stage0/run-worker.sh)). - - If the machine can't be restarted for some reason, set the environment variable `SWARMING_NEVER_REBOOT`. - -## How to set up a builder - - 1. [Create an issue](https://github.com/golang/go/issues/new?labels=new-builder&title=x%2Fbuild%3A+add+LUCI+%3Cos-arch%3E+builder) on the Go Issue tracker requesting the addition of a new builder and assign it yourself. - 1. The title of the issue should be in the format: `x/build: add LUCI builder`. - 1. Choose a hostname. - 1. Add the label "new-builder". (You can post a comment on the issue stating `@gopherbot, please add label new-builder.` in the issue to have [gopherbot](https://go.dev/wiki/gopherbot) add it for you.) - - 1. Use `golang.org/x/build/cmd/genbotcert` to generate both a certificate signing request (_hostname_.csr) and a TLS private key (_hostname_.key) using the hostname (chosen beforehand) as input. Add a .txt file extension to the certificate signing request (_hostname_.csr.txt) and attach it to the GitHub issue. A team member will attach the resulting certificate (_hostname_.cert) to the GitHub issue. - 1. `genbotcert -bot-hostname ` - - 1. A Go team member will define your new builder in [LUCI](https://chromium.googlesource.com/chromium/src/+/master/docs/tour_of_luci_ui.md). A comment will be added to the issue when this is completed. - - 1. The Machine Token Daemon communicates with the Token Server to generate and renew a LUCI machine token. Install `go.chromium.org/luci/tokenserver/cmd/luci_machine_tokend` and configure it to run every 10 minutes via cron. The private key shouldn't be readable by the `swarming` user, so the cron job should run as a separate user. - 1. `luci_machine_tokend -backend luci-token-server.appspot.com -cert-pem -pkey-pem -token-file=/var/lib/luci_machine_tokend/token.json` - 1. If /var/lib isn't a suitable place for the token, change it as you see fit and pass `-token-file-path` to `bootstrapswarm` below to match. - - 1. Install `golang.org/x/build/cmd/bootstrapswarm` and configure it to run in a loop under your operating system's process supervisor (systemd, etc) as the `swarming` user. `Bootstrapswarm` downloads the initial version of the swarming bot and ensures that it is always running. - 1. `bootstrapswarm -hostname ` - - 1. Verify the bot starts up without any errors in the logs. - - - - - - +The Go wiki on GitHub has moved to go.dev (#61940). +Try or . diff --git a/Deprecated.md b/Deprecated.md index 06691424..b4eb6cb6 100644 --- a/Deprecated.md +++ b/Deprecated.md @@ -1,55 +1,4 @@ -Sometimes an API feature such as a struct field, function, type, or even a whole package becomes -redundant or unnecessary. -When we want to discourage new programs from using it, -we mark that feature "deprecated". +The Go wiki on GitHub has moved to go.dev (#61940). -In contrast to some other systems, an API feature being deprecated -_does not_ mean it is going to be removed in the future. -On the contrary, [Go 1 compatibility](https://go.dev/doc/go1compat) -means the feature will be preserved in its deprecated form -to keep existing programs running. +Try or . -To signal that an identifier should not be used, add a paragraph to its doc -comment that begins with `Deprecated:` followed by some information about the -deprecation, and a recommendation on what to use instead, if applicable. -The paragraph does not have to be the last paragraph in the doc comment. - -[Some tools will warn on use of deprecated identifiers](https://staticcheck.io/docs/checks#SA1019) -and their docs [are hidden on pkg.go.dev](https://go.dev/issue/40850). - -If function `F1` is being replaced by function `F2` -and the first release in which `F2` is available is Go 1.N, -then an official deprecation notice for `F1` should not be -added until Go 1.N+1. -This ensures that Go developers only see `F1` as deprecated -when all supported Go versions include `F2` and they can easily switch. - -Marking an API feature deprecated can create work and -decisions for millions of Go developers using the feature. -Deprecating an API feature is an API change that must -be discussed using [the proposal process](https://go.dev/s/proposal). - -## Examples - -```Go -type ResponseRecorder struct { - // HeaderMap contains the headers explicitly set by the Handler. - // It is an internal detail. - // - // Deprecated: HeaderMap exists for historical compatibility - // and should not be used. To access the headers returned by a handler, - // use the Response.Header map as returned by the Result method. - HeaderMap http.Header -``` - -```Go -// Package rc4 implements the RC4 stream cipher. -// -// Deprecated: RC4 is cryptographically broken and should not be used -// except for compatibility with legacy systems. -// -// This package is frozen and no new functionality will be added. -package rc4 -``` - -There are a few other examples [in the standard library](https://cs.opensource.google/search?q=Deprecated:%20language:go&ss=go%2Fgo). \ No newline at end of file diff --git a/DesignDocuments.md b/DesignDocuments.md index 94f6b01e..97219237 100644 --- a/DesignDocuments.md +++ b/DesignDocuments.md @@ -1,62 +1,4 @@ -# Go 1.1 - * [Scalable Scheduler](https://docs.google.com/document/d/1TTj4T2JO42uD5ID9e89oa0sLKhJYD0Y_kqxDv3I3XMw) - * [net/http/cookiejar](https://groups.google.com/d/msg/golang-dev/ygDB3nbir00/rouknDcuyakJ) - * [Function Calls](https://docs.google.com/document/d/1bMwCey-gmqZVTpRax-ESeVuZGmjwbocYs1iHplK-cjo/pub) +The Go wiki on GitHub has moved to go.dev (#61940). -# Go 1.2 +Try or . - * [xml.Marshaler and Unmarshaler](https://go.dev/s/go12xml) - * [encoding.TextMarshaler and Unmarshaler](https://go.dev/s/go12encoding) - * [Runtime Symbol Table Format](https://go.dev/s/go12symtab) - * [Field Selectors and Nil Checks](https://go.dev/s/go12nil) - * [```x[i:j:k]``` Slice Syntax](https://go.dev/s/go12slice) - * [Preemptive Scheduler](https://docs.google.com/document/d/1ETuA2IOmnaQ4j81AtTGT40Y4_Jr6_IDASEKg0t0dBR8/edit?usp=sharing) - -# Go 1.3 - - * [Contiguous Stacks](https://docs.google.com/document/d/1wAaf1rYoM4S4gtnPh0zOlGzWtrZFQ5suE8qr2sD8uWQ/pub) - * [Go 1.3 Linker Overhaul](https://go.dev/s/go13linker) - * [Go 1.3 Native Client Support](https://docs.google.com/document/d/1oA4rs0pfk5NzUyA0YX6QsUEErNIMXawoscw9t0NHafo/pub) - -# Go 1.4 - - * [Go channels on steroids](https://go.dev/s/go13chan) - * [Go 1.4 “Internal” Packages](https://go.dev/s/go14internal) - * [Go 1.4 src/pkg → src](https://go.dev/s/go14nopkg) - * [Go 1.4 Custom Import Path Checking](https://go.dev/s/go14customimport) - * [Go generate: A Proposal](https://go.dev/s/go1.4-generate) - * [The syscall package](https://docs.google.com/a/golang.org/document/d/1QXzI9I1pOfZPujQzxhyRy6EeHYTQitKKjHfpq0zpxZs) - * [Go 1.4 Subrepo Renaming](https://go.dev/s/go14subrepo) - * [Go 1.4 Native Client Support for ARM](https://go.dev/s/go14naclarm) - * [dev.cc branch plan](https://go.dev/s/dev.cc) - -# Go 1.5 - - * [Go 1.5 Bootstrap Plan](https://go.dev/s/go15bootstrap) - * [Go Compiler Overhaul](https://go.dev/s/go13compiler) - * [Go Execution Tracer](http://goo.gl/eXjfeS) - -# Future Proposals - - * [New SSA Backend for the Go Compiler](https://docs.google.com/document/d/1szwabPJJc4J-igUZU4ZKprOrNRNJug2JPD8OYi3i1K0/edit?usp=sharing_eid) - * [Go 1.4+ Garbage Collection (GC) Plan and Roadmap](https://go.dev/s/go14gc) - * [Better GC and Memory Allocator for Go](https://docs.google.com/document/d/1HCPu3WKyCX3ZRYxmIMKTk0Ik1dePxKW1p02k3uhcft4/view) - * [Groups Discussion](https://groups.google.com/d/topic/golang-dev/pwUh0BVFpY0/discussion) - * [Precise GC Stack Roots](https://docs.google.com/document/d/13v_u3UrN2pgUtPnH4y-qfmlXwEEryikFu0SQiwk35SA/pub) - * [Go 1.3 cmd/go and os/fsnotify](https://go.dev/s/go13fsnotify) - * [Go 1.5 os/fsnotify API](http://goo.gl/MrYxyA) - * [Simple Multi-Dimensional Slices (Tables)](https://docs.google.com/document/d/1eHm7KqfKP9_s4vR1zToxq-FBazdUQ9ZYi-YhcEtdfR0/edit) - * [Go execution modes](https://docs.google.com/a/golang.org/document/d/1nr-TQHw_er6GOQRsF6T43GGhFDelrAP0NqSS_00RgZQ/edit) - * [Building and distributing Go packages as shared libraries](https://docs.google.com/a/canonical.com/document/d/1PxhXNhsdqwBjteW7poqv4Vf3PhtTmYuQKkOk_JNWeh0/edit#heading=h.9hyi51rp3owq) - * [NUMA-aware scheduler for Go](https://docs.google.com/document/d/1d3iI2QWURgDIsSR6G2275vMeQ_X7w-qxM2Vp7iGwwuM/pub) - * [Go 1.5+ "External" Packages](https://docs.google.com/document/d/1CJnU6ZKvsp21B0lQwbJlKFt8Zz4EWscaCRy_EwK8ja8) - -# Other Tools - * [Go Oracle](https://docs.google.com/document/d/1WmMHBUjQiuy15JfEnT8YBROQmEv-7K6bV-Y_K53oi5Y) - * [Binding Go and Java](https://go.dev/s/gobind) - * [Go Builder Plan](https://go.dev/s/builderplan) - * [gomobile — a tool for building apps](https://docs.google.com/document/d/1cePOQ35PNEb_QqxnPAmBv0cEnAm7AQSGuz9wVeJ-lBs/edit) - -# Rejected Proposals - * [Read-only Slices](https://docs.google.com/a/golang.org/document/d/1UKu_do3FRvfeN5Bb1RxLohV-zBOJWTzX0E8ZU1bkqX0/edit#heading=h.2wzvdd6vdi83), [Evaluation of read-only slices](https://docs.google.com/document/d/1-NzIYu0qnnsshMBpMPmuO21qd8unlimHgKjRD9qwp2A/edit) ([rejected](https://groups.google.com/d/msg/golang-dev/Y7j4B2r_eDw/Rkq-OtEsEBAJ)) - * [Go 1.4: unsafe.Pointer arithmetic](https://docs.google.com/a/dempsky.org/document/d/1yyCMzE4YPfsXvnZNjhszaYNqavxHhvbY-OWPqdzZK30/pub) \ No newline at end of file diff --git a/Diagnostics.md b/Diagnostics.md index 1f3f3f7a..d92ca180 100644 --- a/Diagnostics.md +++ b/Diagnostics.md @@ -1 +1,4 @@ -Moved to [golang.org](https://tip.golang.org/doc/diagnostics.html). \ No newline at end of file +The Go wiki on GitHub has moved to go.dev (#61940). + +Try or . + diff --git a/Download-build-farm-failed-logs-and-debugging.md b/Download-build-farm-failed-logs-and-debugging.md index 884b6dce..bbe8eac9 100644 --- a/Download-build-farm-failed-logs-and-debugging.md +++ b/Download-build-farm-failed-logs-and-debugging.md @@ -1,15 +1,4 @@ -The Go project has all build failed logs storage at GCE, which you can access by the [dashboard](https://build.golang.org/). +The Go wiki on GitHub has moved to go.dev (#61940). -You can download all the failed logs by `fetchlogs`. +Try or . -Download `fetchlogs` by `go get golang.org/x/build/cmd/fetchlogs` - -`fetchlogs` only download 300 lastest failed logs by default, which is not enough for "mystery"/"flaky" bugs. -`fetchlogs -n ` - -You may also want to take a look at -`github.com/aclements/go-misc/greplogs`. It's a useful tool by Austin -to run grep over logs fetched by fetchlogs. - -Also `github.com/aclements/findflakes` can make some guesses as to when a -flaky test started failing. \ No newline at end of file diff --git a/DragonFly-BSD.md b/DragonFly-BSD.md index 3e3013aa..f6aeb75a 100644 --- a/DragonFly-BSD.md +++ b/DragonFly-BSD.md @@ -1,19 +1,4 @@ -# Go on DragonFly BSD +The Go wiki on GitHub has moved to go.dev (#61940). -From https://github.com/golang/go/issues/34958#issuecomment-543852995 : +Try or . -> Go's DragonFly support policy is that we support the latest stable -> release primarily, but also try to keep DragonFly master passing, in -> prep for it to become the latest stable release. -> -> But that does mean we need one more builder at the moment. - -| **Kernel version** | **Architectures** | **Initial support version** | **Final support version** | -|:------------------------|:------------------|:----------------------------|:--------------------------| -| 4.6 or above | amd64 | Go 1.8 | | -| 4.4.4 (EOL) | amd64 | Go 1.8 | | -| 4.4 through 4.4.3 (EOL) | amd64 | Go 1.3 _*_ | Go 1.7.6 | -| 3.8 through 4.2 (EOL) | amd64 | Go 1.3 _*_ | Go 1.7.6 | -| 3.6 (EOL) | amd64, 386 | Go 1.3 | Go 1.4.3 | - -_*_ Go 1.5 or above is recommended. \ No newline at end of file diff --git a/ErrorValueFAQ.md b/ErrorValueFAQ.md index 1e353e98..6d457161 100644 --- a/ErrorValueFAQ.md +++ b/ErrorValueFAQ.md @@ -1,145 +1,4 @@ -# Error Values: Frequently Asked Questions +The Go wiki on GitHub has moved to go.dev (#61940). -The Go 2 [error values proposal](https://go.googlesource.com/proposal/+/master/design/29934-error-values.md) adds functionality to the [`errors`](https://tip.golang.org/pkg/errors) and [`fmt`](https://tip.golang.org/pkg/fmt) packages of the standard library for Go 1.13. There is also a compatibility package, [`golang.org/x/xerrors`](https://pkg.go.dev/golang.org/x/xerrors), for earlier Go versions. +Try or . -We suggest using the `xerrors` package for backwards compatibility. When you no longer wish to support Go versions before 1.13, use the corresponding standard library functions. This FAQ uses the `errors` and `fmt` packages from Go 1.13. - -## How should I change my error-handling code to work with the new features? - -You need to be prepared that errors you get may be wrapped. - -- If you currently compare errors using `==`, use `errors.Is` instead. Example: - ``` - if err == io.ErrUnexpectedEOF - ``` - becomes - ``` - if errors.Is(err, io.ErrUnexpectedEOF) - ``` - - - Checks of the form `if err != nil` need not be changed. - - Comparisons to `io.EOF` need not be changed, because `io.EOF` should never be wrapped. - -- If you check for an error type using a type assertion or type switch, use `errors.As` instead. Example: - ``` - if e, ok := err.(*os.PathError); ok - ``` - becomes - ``` - var e *os.PathError - if errors.As(err, &e) - ``` - - Also use this pattern to check whether an error implements an interface. (This is one of those rare cases when a pointer to an interface is appropriate.) - - Rewrite a type switch as a sequence of if-elses. - -## I am already using `fmt.Errorf` with `%v` or `%s` to provide context for an error. When should I switch to `%w`? - -It's common to see code like -``` -if err := frob(thing); err != nil { - return fmt.Errorf("while frobbing: %v", err) -} -``` -With the new error features, that code continues to work exactly as before, constructing a string that includes the text of `err`. Changing from `%v` to `%w` doesn't change that string, but it does wrap `err`, allowing the caller to access it using `errors.Unwrap`, `errors.Is` or `errors.As`. - -So use `%w` if you want to expose the underlying error to your callers. Keep in mind that doing so may be exposing implementation detail that can constrain the evolution of your code. Callers can depend on the type and value of the error you're wrapping, so changing that error can now break them. For example, if the `AccessDatabase` function of your package `pkg` uses Go's `database/sql` package, then it may encounter a `sql.ErrTxDone` error. If you return that error with `fmt.Errorf("accessing DB: %v", err)` then callers won't see that `sql.ErrTxtDone` is part of the error you return. But if you instead return `fmt.Errorf("accessing DB: %w", err)`, then a caller could reasonably write -``` -err := pkg.AccessDatabase(...) -if errors.Is(err, sql.ErrTxDone) ... -``` -At that point, you must always return `sql.ErrTxDone` if you don't want to break your clients, even if you switch to a different database package. - -## How can I add context to an error I'm already returning without breaking clients? - -Say your code now looks like -``` -return err -``` -and you decide that you want to add more information to `err` before you return it. If you write - -``` -return fmt.Errorf("more info: %v", err) -``` -then you might break your clients, because the identity of `err` is lost; only its message remains. - -You could instead wrap the error by using `%w`, writing -``` -return fmt.Errorf("more info: %w", err) -``` -This will still break clients who use `==` or type assertion to test errors. But as we discussed in the first question of this FAQ, consumers of errors should migrate to the `errors.Is` and `errors.As` functions. If you can be sure that your clients have done so, then it is not a breaking change to switch from -``` -return err -``` -to -``` -return fmt.Errorf("more info: %w", err) -``` - -## I'm writing new code, with no clients. Should I wrap returned errors or not? - -Since you have no clients, you aren't constrained by backwards compatibility. But you still need to balance two opposing considerations: -- Giving client code access to underlying errors can help it make decisions, which can lead to better software. -- Every error you expose becomes part of your API: your clients may come to rely on it, so you can't change it. - -For each error you return, you have to weigh the choice between helping your clients and locking yourself in. Of course, this choice is not unique to errors; as a package author, you make many decisions about whether a feature of your code is important for clients to know or an implementation detail. - -With errors, though, there is an intermediate choice: you can expose error details to people reading your code's error messages without exposing the errors themselves to client code. One way to do that is to put the details in a string using `fmt.Errorf` with `%s` or `%v`. Another is to write a custom error type, add the details to the string returned by its `Error` method, and avoid defining an `Unwrap` method. - -## I maintain a package that exports an error-checking predicate function. How should I adapt to the new features? - -Your package has a function or method `IsX(error) bool` that reports whether an error has some property. -A natural thought would be to modify `IsX` to unwrap the error it is passed, checking the property for each error in the chain of wrapped errors. We advise against doing this: the change in behavior could break your users. - -Your situation is like that of the standard `os` package, which has several such functions. We recommend the approach we took there. The `os` package has several predicates, but we treated most of them the same. For concreteness, we'll look at `os.IsExist`. - -Instead of changing `os.IsExist`, we made `errors.Is(err, os.ErrExist)` behave like it, except that `Is` unwraps. (We did this by having `syscall.Errno` implement an `Is` method, as described in the documentation for [`errors.Is`](https://pkg.go.dev/errors/#Is).) Using `errors.Is` will always work correctly, because it will exist only in Go versions 1.13 and higher. For older versions of Go, you should recursively unwrap the error yourself, calling `os.IsExist` on each underlying error. - -This technique only works if you have control of the errors being wrapped, so you can add `Is` methods to them. -In that case, we recommend: -- Don't change your `IsX(error) bool` function; do change its documentation to clarify that it does not unwrap. -- If you don't already have one, add a global variable whose type implements `error` that represents the - condition that your function tests: - ``` - var ErrX = errors.New("has property X") - ``` -- Add an `Is` method to the types for which `IsX` returns true. The `Is` method should return true if its argument - equals `ErrX`. - -If you don't have control of all the errors that can have property X, you should instead consider adding another function that tests for the property while unwrapping, perhaps -``` -func IsXUnwrap(err error) bool { - for e := err; e != nil; e = errors.Unwrap(e) { - if IsX(e) { - return true - } - } - return false -} -``` - -Or you could leave things as they are, and let your users do the unwrapping themselves. Either way, you should still change the documentation of `IsX` to clarify that it does not unwrap. - -## I have a type that implements `error` and holds a nested error. How should I adapt it to the new features? - -If your type already exposes the error, write an `Unwrap` method. - -For example, perhaps your type looks like -``` -type MyError struct { - Err error - // other fields -} - -func (e *MyError) Error() string { return ... } -``` - -Then you should add -``` -func (e *MyError) Unwrap() error { return e.Err } -``` - -Your type will then work correctly with the `Is` and `As` functions of `errors` and `xerrors`. - -We've done that for [`os.PathError`](https://tip.golang.org/pkg/os/#PathError.Unwrap) and other, similar types in the standard library. - -It's clear that writing an `Unwrap` method is the right choice if the nested error is exported, or otherwise visible to code outside your package, such as via a method like `Unwrap`. But if the nested error is not exposed to outside code, you probably should keep it that way. Making the error visible by returning it from `Unwrap` will enable your clients to depend on the type of the nested error, which can expose implementation details and constrain the evolution of your package. See the discussion of `%w` above for more. diff --git a/Errors.md b/Errors.md index 57eeae5f..ba2148a6 100644 --- a/Errors.md +++ b/Errors.md @@ -1,102 +1,4 @@ -# Errors +The Go wiki on GitHub has moved to go.dev (#61940). -Errors are indicated by returning an `error` as an additional return value from a function. A `nil` value means that there was no error. +Try or . -` error `s can be turned into strings by calling `Error`, their only method. You can create an error from a string by calling `errors.New`: - -```go -if failure { - return errors.New("inverse tachyon pulse failed") -} -``` - -or by using `fmt.Errorf`: - -```go -if failure { - return fmt.Errorf("inverse tachyon pulse failed") -} -``` - -Error strings should not start with a capital letter because they'll often be prefixed before printing: - -```go -err := TryInverseTachyonPulse() -if err != nil { - fmt.Printf("failed to solve problem: %s\n", err) -} -``` - -If you expect calling code to be able to handle an error, you can distinguish classes of errors either by returning special values, or new types. You only need to distinguish differences that the calling code could be expected to handle in this way as the string allows one to communicate the details of the error. - -`io.EOF` is a special value that signals the end of a stream. You can compare error values directly against io.EOF. - -If you want to carry extra data with the error, you can use a new type: - -```go -type ParseError struct { - Line, Col int -} - -func (p ParseError) Error() string { - return fmt.Sprintf("parse error on line %d, column %d", p.Line, p.Col) -} -``` - -If you want to create a constant string error, you can use a named type string: - -```go -type errorConst string - -const ErrTooManyErrors errorConst = "too many errors found." - -func (e errorConst) Error() string { - return string(e) -} -``` - -Calling code would test for a special type of `error` by using a type switch: - -```go -switch err := err.(type) { -case ParseError: - PrintParseError(err) -} -``` - -## Naming - -Error types end in `"Error"` and error variables start with `"Err"` or `"err"`: - -```go -package somepkg - -// ParseError is type of error returned when there's a parsing problem. -type ParseError struct { - Line, Col int -} - -var ErrBadAction = errors.New("somepkg: a bad action was performed") - -// ----- - -package foo - -func foo() { - res, err := somepkgAction() - if err != nil { - if err == somepkg.ErrBadAction { - } - if pe, ok := err.(*somepkg.ParseError); ok { - line, col := pe.Line, pe.Col - // .... - } - } -} -``` - -## References - - * Errors (specification): https://go.dev/ref/spec#Errors - * Package `errors`: https://pkg.go.dev/errors/ - * Type switches: https://go.dev/ref/spec#TypeSwitchStmt \ No newline at end of file diff --git a/ExperienceReports.md b/ExperienceReports.md index efac28ba..db7cbb4b 100644 --- a/ExperienceReports.md +++ b/ExperienceReports.md @@ -1,259 +1,4 @@ -This page collects experience reports about problems with Go that might inform our design of solutions to those problems. These reports should focus on the _problems_: they should not focus on and need not propose solutions. To propose solutions, see the [proposal process](https://go.dev/s/proposal). +The Go wiki on GitHub has moved to go.dev (#61940). -We hope to use these experience reports to understand where people are having trouble writing Go, to help us prioritize future changes to the Go ecosystem. (We do not promise to reply to these. If you need immediate help answering questions about Go, see [https://go.dev/help/](https://go.dev/help/) for resources.) +Try or . -__The best experience reports tell: (1) what you wanted to do, (2) what you actually did, and (3) why that wasn’t great, illustrating those by real concrete examples, ideally from production use.__ Please write these reports about the problems most significant to you, post them on your own blog, or on Medium, or as a [Github Gist](https://gist.github.com/) (use a `.md` extension for Markdown), or as a publicly-readable Google doc, and then link them here. (Talk videos or slides are also welcome, although they are not as convenient for us to digest.) - -If you do not have permission to edit the wiki to add an article to this list, [please file an issue](https://go.dev/issue/new). - -Please keep the overall page sorted alphabetically by section (Error Handling before Logging, and so on). -Within a section, please keep articles sorted chronologically. -It's helpful to include a one-phrase summary of the point of each article. - -Add new sections as appropriate. - -**Table of Contents** - - - [App and Game Development](#app-and-game-development) - - [Concurrency](#concurrency) - - [Casting](#casting) - - [Context](#context) - - [Declarations](#declarations) - - [Dependencies](#dependencies) - - [Documentation](#documentation) - - [Diagnostics and Debugging](#diagnostics-and-debugging) - - [Education and Teaching](#education-and-teaching) - - [Error Handling](#error-handling) - - [Error Values](#error-values) - - [File System](#file-system) - - [Generics](#generics) - - [GoMobile](#gomobile) - - [Immutability](#immutability) - - [Inter Process Communication](#inter-process-communication) - - [Large-Scale Software Development](#large-scale-software-development) - - [Literals](#literals) - - [Logging](#logging) - - [Misc/Multiple](#misc--multiple) - - [Modules](#modules) - - [Performance](#performance) - - [Porting](#porting) - - [Slices](#slices) - - [Syntax](#syntax) - - [Time](#time) - - [Tooling](#tooling) - - [Type System](#type-system) - - [Typed nils](#typed-nils) - - [Vendoring](#vendoring) - -## App and Game Development - - - Paul Ruest, "[Go Library Support for Apps and Games](https://gazed.github.io/goApps.html)", November 2017 - - Tad Vizbaras, "[Building Optical Character Recognition (OCR) in Go](http://recoink.com/goreport)", December 2017 - -## Casting - - Richard Warburton, "[Should Go Casting be permitted when underlying data structures are the same?](https://gist.github.com/krolaw/f010ab0966fd379725ecc48e8bbcac1c)", December 2017 - -## Concurrency - - - Sergey Kamardin, “[A Million WebSockets and Go](https://medium.freecodecamp.org/million-websockets-and-go-cc58418460bb),” August 2017, about the memory overhead of blocked read/write goroutines. - - Nathaniel J. Smith, “[Notes on structured concurrency, or: Go statement considered harmful](https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful/)”, April 2018. - -## Context - - - Sam Vilain, “[Using Go's context library for making your logs make sense](https://blog.gopheracademy.com/advent-2016/context-logging/),” December 2016, about extracting structured log values from context. - - Jon Calhoun, “[Pitfalls of context values and how to avoid or mitigate them in Go](https://www.calhoun.io/pitfalls-of-context-values-and-how-to-avoid-or-mitigate-them/),” February 2017. - - Michal Štrba, "[Context should go away for Go 2](https://faiface.github.io/post/context-should-go-away-go2/)," August 2017 - - Axel Wagner, "[Why context.Value matters and how to improve it](https://blog.merovius.de/2017/08/14/why-context-value-matters-and-how-to-improve-it.html)," August 2017. - - Dave Cheney, "[Context isn't for cancellation](https://dave.cheney.net/2017/08/20/context-isnt-for-cancellation)," August 2017. - - Ross Light, "[Canceling I/O in Go Cap'n Proto](https://medium.com/@zombiezen/canceling-i-o-in-go-capn-proto-5ae8c09c5b29)," January 2018. - - Iman Tumorang, "[Avoiding Memory Leak in Golang API](https://hackernoon.com/avoiding-memory-leak-in-golang-api-1843ef45fca8)," January 2018. - -## Declarations - - - Christophe Meessen, "[Problems with Go's shorthand declaration :=](https://gist.github.com/chmike/ac0113afefbc04e67323b4a3688d6b54#file-godeclareproblem-md)", July 2017, about the shadowing var trap and apparent inconsistency of `:=`. - - Brian Will, "[Go's := syntax is error-prone with multiple target variables](https://gist.github.com/BrianWill/671ce51e6ef6a9f0caa27272a9a0637f)", August 2017. - -## Dependencies - - - Patrick Bohan, "[Docker => Moby: Go Dependencies](http://engineering.rallyhealth.com/go/golang/dependencies/package-managers/2017/06/28/go-and-dependencies.html)," Jun 28, 2017. A new Go team's struggles with dependency management and an approach to deal with them. - - Judson Lester, "[untitled gist] (https://gist.github.com/nyarly/edb6b7a5e3a762da6a5e2da8f59acf07)", August 2017. - - David Collier-Brown, "[Avoiding an NP-Complete Problem by Recycling Multics’ Answer](https://leaflessca.wordpress.com/2018/09/03/avoiding-an-np-complete-problem-by-recycling-multics-answer/)", September 2018. - - Adrian Hesketh "[Security vulnerability tracking](https://gist.github.com/a-h/f0fd0fad5e8a2e0c9b7afcf84f51f286)", January 2018. Proving to a security auditor that code doesn't contain known vulnerabilities. - -## Diagnostics and Debugging - - - Kevin Burke, "[How I'm running benchmarks and printing their results](https://github.com/kevinburke/go-html-boilerplate/blob/master/Makefile#L38)", it would be nice if I didn't need so much Unix glue to run and print these. July 2017. - - - John Clarke, Tracking down an intermittent fault (not a race) by running a very slow {hit test failure, increase logging} cycle by running "do { go test -race } while ( $LASTEXITCODE -eq 0 )" overnight. Over many nights. Execution trace functionality like https://rr-project.org/ would be transformative. November 2018. - - - `guanw`, [`cmd/trace` and PySnooper](https://github.com/guanw/go-proposal/blob/master/proposal.md). Comparison of `cmd/trace` with a (more succinct) Python tracing API. May 2019. - -## Documentation - - - Kevin Burke, "[Need to add documentation for a binary in three different places](https://github.com/golang/go/issues/20212)", May 2017. - -## Education and Teaching - - - Carl Kingsford and Phillip Compeau, "[Go 2.0 for Teaching](http://www.monogrammedchalk.com/go-2-for-teaching/)". Experience using Go in an introductory programming course. - -## Error Handling - -(This section is about writing `if err != nil`.) - - - Andrew Gerrand, “[Error Handling and Go](https://go.dev/blog/error-handling-and-go),” July 2011, - showing Go error handling patterns. - - Martin Sústrik, “[Why should I have written ZeroMQ in C, not C++ (part I)](http://www.250bpm.com/blog:4),” May 2012, - discussing production problems with C++ exception handling due to error-handling code being far from code that causes the error. - - Thomi Richards, “[The Problems with Errors](http://www.tech-foo.net/the-problems-with-errors.html),” March 2014, - arguing that it's essential for code to document exactly which errors it returns / exceptions it might throw. - - Roger Peppe, “[Lovin' your errors](https://rogpeppe.neocities.org/error-loving-talk/index.html),” March 2015, discussing idioms for error handling. - - Bleve, “[Deferred Cleanup, Checking Errors, and Potential Problems](http://www.blevesearch.com/news/Deferred-Cleanup,-Checking-Errors,-and-Potential-Problems/),” September 2015, - showing a bug related to error handling and defer in Bleve search. - - Andrew Morgan, “[What I Don't Like About Error Handling in Go, and How to Work Around It](https://opencredo.com/why-i-dont-like-error-handling-in-go/),” January 2017, - about it being difficult to force good error handling, errors not having stack traces, and error handling being too verbose. - - André Hänsel, "[If Ⅰ were to make my own Go…](https://blog.creations.de/?p=223)", August 2017 - - Peter Goetz, "[Thinking About New Ways of Error Handling in Go 2](https://medium.com/@peter.gtz/thinking-about-new-ways-of-error-handling-in-go-2-e56d116952f1)," September 2017, shows how error-prone error handling in Go is and lays out requirements to improve the experience. - -## Error Values - -(This section is about additional error semantics beyond the `Error() string` method.) - - - Andrew Morgan, “[What I Don't Like About Error Handling in Go, and How to Work Around It](https://opencredo.com/why-i-dont-like-error-handling-in-go/),” January 2017, - about it being difficult to force good error handling, errors not having stack traces, and error handling being too verbose. - - Chris Siebenmann, “[Go's net package doesn't have opaque errors, just undocumented ones](https://utcc.utoronto.ca/~cks/space/blog/programming/GoNetErrorsUndocumented),” August 2018 - - Bryan C. Mills, “[Error Wrapping and Redundancy in Go](https://github.com/bcmills/go-experience-reports/blob/master/errors.md),” September 2019 - -## File System - - - Chris Lewis, “[Non-Local File Systems Should Be Supported](https://gist.github.com/cflewis/87843028576459b0f6ebf55f1b200891),” July 2017. Proposes replacing file system read calls to something more abstracted like the `sql` package does. - -## Generics - - - “[Summary of Go Generics Discussions (living document)](https://docs.google.com/document/d/1vrAy9gMpMoS3uaVphB32uVXX4pi-HnNjkMEgyAHX4N4/edit).” - - Bouke van der Bijl, “[Idiomatic Generics in Go](https://web.archive.org/web/20141001043016/http://bouk.co/blog/idiomatic-generics-in-go/),” September 2014. - - Craig Weber, “[Living without generics in Go](https://web.archive.org/web/20141227092139/http://www.weberc2.com/posts/2014/12/12/living-without-generics.txt),” December 2014. - - Shashank Sharma, “[Poor man's generics in Golang (Go)](https://codeblog.shank.in/poor-mans-generics-in-golang/),” May 2016. - - Niek Sanders, “[Overhead of Go's generic sort](https://github.com/nieksand/sortgenerics),” September 2016, - documenting the overhead of sorting using sort.Interface instead of specialized code. - - Jon Calhoun, “[Using code generation to survive without generics in Go](https://www.calhoun.io/using-code-generation-to-survive-without-generics-in-go/),” May 2017. - - Jon Bodner, “[Closures are the Generics for Go](https://medium.com/capital-one-developers/closures-are-the-generics-for-go-cb32021fb5b5),” June 2017. - - Andrew Stock, "[Why I miss generics in Go](https://medium.com/@watchforstock/why-i-miss-generics-in-go-9aef810a1bef)," June 2017 - - Kevin Burke, "[Code example with lots of interface casts](https://gist.github.com/kevinburke/a10aed6d8d07ecd5efe658b21cd168c1)," requires a lot of boilerplate/casts. - - Ian Lance Taylor, "[The append function](https://www.airs.com/blog/archives/559)," July 2017. - - DeedleFake, "[The Problem with Interfaces](https://deedlefake.com/2017/07/the-problem-with-interfaces/)", July 2017. - - Kurtis Nusbaum "[Why I'm So Frustrated With Go](https://hackernoon.com/why-im-so-frustrated-with-go-97c0c4ae214e)," June 2017 - - Juan Álvarez, "[Generics on Go's stdlib](https://medium.com/@shixzie/generics-on-gos-stdlib-10de52fe824d)", July 2017. - - David Chase, "[A use case for Go Generics in a Go Compiler](https://dr2chase.wordpress.com/2017/08/09/a-use-case-for-go-generics-in-a-go-compiler/)", August 2017 - - Varun Kumar, "[Generics - I Wish You Were Here...](https://varunksaini.com/blog/use-case-for-generics/)", August 2017 - - Sameer Ajmani, "[Go Experience Report for Generics: Google metrics API](https://medium.com/@sameer_74231/go-experience-report-for-generics-google-metrics-api-b019d597aaa4)", August 2017 - - Chewxy, "[Tensor Refactor: A Go Experience Report](https://blog.chewxy.com/2017/09/11/tensor-refactor/)", September 2017, discusses the lack of generics and how it affects building high performance multidimensional arrays for different data types (having to resort to a lot of pointer ugliness, and manually keeping track of type and runtime type checking) - - qwerty2501,"[A problem runtime error due to lack of Generics](https://gist.github.com/qwerty2501/8839af87946571943a6c4f623c6124e2)", October 2017 - - posener, "[Why I recommend to avoid using the go-kit library](https://gist.github.com/posener/330c2b08aaefdea6f900ff0543773b2e)", clear separation of concern need lots of boilerplate code. gokit try -code generation to avoid this [#70](https://github.com/go-kit/kit/issues/70) [#308](https://github.com/go-kit/kit/pull/308) [protoc-gen-gokit](https://github.com/AmandaCameron/protoc-gen-gokit) , but it looks like -a complex solution for the problem. - - Xavier Leroy, "[A modular module system](http://gallium.inria.fr/%7Exleroy/publi/modular-modules-jfp.pdf)", paper about module description for generics. - - Tobias Gustafsson, "[Experiences implementing PEDS](https://github.com/tobgu/peds/blob/master/experience_report.md)", PEDS is a set of statically type safe, immutable/persistent, collections. November 2017 - - A Googler "[govisor/generics.go](https://github.com/google/gvisor/blob/master/tools/go_generics/generics.go)". April 27, 2018 - -## GoMobile - - Vijay, "[Nested structs and slices not supported in gomobile]" - -## Immutability - - Kurtis Nusbaum "[Why I'm So Frustrated With Go](https://hackernoon.com/why-im-so-frustrated-with-go-97c0c4ae214e)," June 2017 - - Sindre Myren "[Go 2.0: Retain simplicity by trading features](https://medium.com/@smyrman/go-2-0-retain-simplicity-by-trading-features-b310b60862ea)" July 2017 - - Tobias Gustafsson, "[Experiences implementing PEDS](https://github.com/tobgu/peds/blob/master/experience_report.md)", PEDS is a set of statically type safe, immutable/persistent, collections. November 2017 - -## Inter Process Communication - - Pablo R. Larraondo "[A Go interprocess communication model](https://gist.github.com/prl900/a7aaa41707e2236592da5e78d8a10dc9)," August 2017 - -## Large-Scale Software Development - - Russ Cox, “[Codebase Refactoring (with help from Go)](https://talks.golang.org/2016/refactor.article),” November 2016, laying out the gradual code repair problem addressed in part by type aliases ([#18130](https://go.dev/issue/18130)). - - Travis Jeffery, "[I'll take pkg over internal](https://travisjeffery.com/b/2019/11/i-ll-take-pkg-over-internal/)," November 2019; talking about Go project layouts, problems with internal, and why people use pkg. - -## Literals - - Mike Schinkel, "[Managing string literals is a PITA, not just in GoLang but in (all?) other languages](https://gist.github.com/mikeschinkel/be502cb73fb1ef535749816ba1817dc3)," June 2022, proposing "Literal String" and "Literal Template" types. - -## Logging - - - Evan Miller, “[Logging can be tricky](http://corner.squareup.com/2014/09/logging-can-be-tricky.html),” September 2014, - showing how logging can add to application tail latency. - - Dave Cheney, “[Let's talk about logging](https://dave.cheney.net/2015/11/05/lets-talk-about-logging),” November 2015, - arguing that there are only two log levels. - - TJ Holowaychuk, “[Apex log](https://medium.com/@tjholowaychuk/apex-log-e8d9627f4a9a),” January 2016, describing a structured log package and how it would be used in production. - - Paddy Foran, “[Logging in Go](https://dramafeveronline.com/),” February 2016, showing how sends Go program logs to Sentry. - - Martin Angers, “[About Go logging for reusable packages](https://www.0value.com/about-go-logging),” March 2016, making suggestions for how to write code that doesn't assume a particular log package. - - BugReplay.com, “[How to use Google Cloud's Free Structured Logging Service With Golang](http://blog.bugreplay.com/post/150086459149/how-to-use-google-clouds-free-structured-logging),” September 2016. - - Sam Vilain, “[Using Go's context library for making your logs make sense](https://blog.gopheracademy.com/advent-2016/context-logging/),” December 2016, about extracting structured log values from context. - - Logmatic, “[Our Guide to a Golang Logs World](https://logmatic.io/blog/our-guide-to-a-golang-logs-world/),” March 2017. - - Chris Hines, Peter Bourgon, “[Proposal: standard Logger interface](https://docs.google.com/document/d/1shW9DZJXOeGbG9Mr9Us9MiaPqmlcVatD_D8lrOXRNMU/edit?usp=drive_web),“ February 2017, problems related to stdlib logger, especially in the context of libraries, and one proposed solution. - - Sindre Myren, "[There is nothing Goish about log.Fatal](https://medium.com/@smyrman/there-is-nothing-goish-about-log-fatal-4ab24ae5ba7)" August 2017, how poorly log.Fatal plays with defer, and a simple pattern for delaing with it in Go 1.x and Go 2.x. - - Joonas Loppi, "[An idea to fix Go´s logging mess](https://joonas.fi/2018/12/04/an-idea-to-fix-gos-logging-mess/)" December 2017, just use *log.Logger as an interface everywhere and compose solutions around it. - -## Misc / Multiple - - Iman Tumorang, "[Trying Clean Architecture on Golang](https://hackernoon.com/golang-clean-archithecture-efd6d7c43047)" July 2017 - - Laurent Demailly, "[My Go lang experience, part 1](https://laurentsv.com/blog/2017/12/28/about-golang.html)" December 2017, a laundry list of pros and cons with current Go from an experienced C/C++/Java/Scripting languages developer perspective. - - Gokcehan Kara, "[Installation with Go Language can be Simpler](https://gokcehan.github.io/posts/installation-with-go-language-can-be-simpler.html)" May 2018, some complications about the installation and distribution of static stripped binaries with version information. - - Bob Nystrom, "[The Language I Wish Go Was](https://journal.stuffwithstuff.com/2010/10/21/the-language-i-wish-go-was/)" October 2010, I wish Go had tuples, unions, constructors, no Nil, exceptions, generics, some syntax sugar, and ponies that shoot Cheez Whiz out of their noses. - -## Modules - - Paul Jolly - "[Creating a submodule within an existing module](https://gist.github.com/myitcv/79c3f12372e13b0cbbdf0411c8c46fd5)" - covers multi-module repos, cyclic module dependencies and the steps required to move between various "states" - - Chi authors - [Github comment](https://github.com/go-chi/chi/pull/378#issuecomment-453274681) - comment on why the Chi authors held out on implementing Go Modules support (which has been added in the meantime). TL;DR ­— due to the import compatibility rule. - - Sam Whited -"[Supporting Go Modules](https://blog.samwhited.com/2019/01/supporting-go-modules/)" - Things learned from upgrading 20 so modules. TL;DR — upgrading large modules past v1 is a huge pain and needs tooling, failure modes for modules are very complex and it's easy to screw up adding modules support to existing projects. - - Stripe Github thread (linked comment down) - [reverting support for Go Modules](https://github.com/stripe/stripe-go/pull/712#issuecomment-454594534). TL;DR — Stripe is reverting Go Modules support because there is no clear upgrade path from dep for modules above v1. - - [Referencing bash scripts in `GOPATH`](https://gist.github.com/ineiti/4a4a1798876225f7a553a13120d705ae) - - [Go Modules on Badger and Dgraph](https://discuss.dgraph.io/t/go-modules-on-badger-and-dgraph/4662). TL;DR - Dgraph is dropping support for v2 because it forces non-Go modules users to change their code. - - [A survey on Golang's dependency management modes (GOPATH and Go Modules): status quo, problems and challenges](https://github.com/KateGo520/Hero/issues/1). - The purpose of this report is to help developers better understand the issues in the transition from GOPATH to Go Modules. - -## Performance - - - Kevin Burke, "[Real Life Go Benchmarking](https://kev.inburke.com/kevin/real-life-go-benchmarking/)," trying to explain to the average developer how to use tools like pprof, maybe this could be easier. July 2016. - - Nathan Kerr, "[Concurrency Slower?](https://pocketgophers.com/concurrency-slower/)", shows how to use Go's testing, benchmarking, and profiling tools to improve the performance of a concurrent implementation of a function. April 2017. - -## Porting - - Shannon Pekary, "[Why GOPP](https://github.com/spekary/gopp/blob/master/Why.md)," an attempt to create -a 'class' keyword that simply makes a struct to also be an interface to make porting code from object-oriented languages much easier. - -## Slices - - Richard Warburton, "[Should Go 2.0 support slice comparison?](https://gist.github.com/krolaw/3205a3139d423b0c39e24b98c923b1a1)," an argument to treat slices as structs for equality comparison, ignoring backing arrays. - - "[Deduplicating a slice is too cumbersome](https://gist.github.com/kevinburke/ad20587e6694acb9251f7d7e25c77078)," a 10-line function in your source code vs. e.g. Ruby's `uniq` function. - - "[Counter-intuitive behaviour of Go variadic functions](https://gist.github.com/dpinela/f7fdeb0ce3e1f0b4f495917ad9210a85),", January 2018, stumbling blocks encountered when expanding slices into argument lists. - -## Syntax - - André Hänsel, "[If Ⅰ were to make my own Go…](https://blog.creations.de/?p=223)", August 2017 - - Bojan Zivanovic, "[Optional function parameters](https://bojanz.github.io/optional-parameters-go/)", May 2020 - - Raanan Hadar, "[A data scientist's take on Go](https://medium.com/@rhadar/a-data-scientists-take-on-go-ed408c00ac45)", September 2020 - -## Time - - - John Graham-Cumming, “[How and Why the Leap Second Affected Cloudflare DNS](https://blog.cloudflare.com/how-and-why-the-leap-second-affected-cloudflare-dns/),” January 2017, about timing across leap seconds ([#12914](https://go.dev/issue/12914)). - -## Tooling - - - Jonathan Ingram, “[gofmt is not opinionated enough](https://gist.github.com/jonathaningram/2b62022844348f3407518dd3a180ef42)”, August 2017, about ongoing debates between developers regarding code style because `gofmt` is not opinionated enough. - - Jean-Laurent de Morlhon, "[Pourquoi Maurice ne doit surtout pas coder en GO](https://www.youtube.com/watch?v=LIFZPzupwgs), talk about Go from a java developper perspective ("go dep" is not enough,...), slides are in english. - -## Type System - - - Sam Whited, “[Faking Enumeration Types with Consts and Unexported Types](https://gist.github.com/SamWhited/6cdbc49b4562e1a1b0526af523f5c5d7)”, July 2017, about attempting to ensure compile time correctness of values provided to an API using the type system. - - Andreas Matuschek, "[Operator Methods](https://gist.github.com/maj-o/9cab355e3e5e4f6f66dbf0a8f24cd13a)", July 2017, just to remember that there are problems with types without corresponding operators ([#19770](https://github.com/golang/go/issues/19770)). - - Leigh McCulloch, "[Go: Experience Report: Pointers](https://leighmcculloch.com/posts/go-experience-report-pointers/)", July 2017, about pointers being used for both transferring ownership and indicating a lack of value. - - Jack Lindamood, "[Interface wrapping method erasure](https://medium.com/@cep21/interface-wrapping-method-erasure-c523b3549912)", July 2017, about the loss of information due to type wrappers -- Sam Whited, “[The Case for interface{}](https://blog.samwhited.com/2017/08/the-case-for-interface/)”, Aug 2017, two examples of using interface and why one is bad (but necessary) and one is good. -- James Frasché, "[Sum types experience report](https://gist.github.com/jimmyfrasche/ba2b709cdc390585ba8c43c989797325)", Aug 2017, issues caused by inability to restrict to a closed set of types -- Robin Eklind, "[Specific use cases. In response to James Frasché's 'Sum types experience report'](https://gist.github.com/jimmyfrasche/ba2b709cdc390585ba8c43c989797325#gistcomment-2181410)", Aug 2017, issues caused by inability to restrict to a closed set of types -- Rick Branson, "[Implicit Pointers = Explicitly Bad](https://docs.google.com/document/d/1va7f4YvExK4mNBmMt2RMg1SNSHyljc8ARVp2ATKtBwU/edit?usp=sharing)", Sep 2017, issues encountered with parameters/variables with interface types as implicit references -- Chewxy, "[Tensor Refactor: A Go Experience Report](https://blog.chewxy.com/2017/09/11/tensor-refactor/)", September 2017, issues regarding discussion of a type system in Go -- Walter Schulze, "[Generic functions cannot be passed as values](https://gist.github.com/awalterschulze/e3999f8cfa29b246c35a651a2be4d121)", September 2017 -- Walter, Schulze, "[For Sum Types: Multiple return parameters are overrated](https://awalterschulze.github.io/blog/post/sum-types-over-multiple-returns/)", September 2017 -- Nicolas, Boulay "[Sum type not always the best choice (Typed tagless-final interpretations)](https://gist.github.com/nicolasboulay/a8ee4a65e8c2cc110c20e6d24e838e86), October 2017 -- Eduard Urbach, "[Type-casting interface{} to chan interface{}](https://github.com/blitzprog/go-channel-type-casting)", October 2017 -- David Vennik, "[Unjumbling Golang OOP primitives](https://gist.github.com/l0k1verloren/344956daedb434094e9af2c21ff9376c)", April 20, 2018 - The problem of the lack of structuring in OOP primitives - dummy functions and redundant boilerplate type bindings. -- Jelte Fennema, "[Fixing the billion dollar mistake in Go by borrowing from Rust](https://getstream.io/blog/fixing-the-billion-dollar-mistake-in-go-by-borrowing-from-rust/)", June 14, 2018 - Nil pointer dereferences cause panics in production - it would be great if the type system would catch some of those. - -## Typed nils - - - David Cheney, "[Typed nils in Go 2](https://dave.cheney.net/2017/08/09/typed-nils-in-go-2)", August 2017. - -## Vendoring - - Jeremy Loy, "[Go Modules and Vendoring](https://github.com/golang/go/issues/27227#issuecomment-420428896)", September 2018. - - Ian Davis, "[Vendoring for self-contained builds](https://github.com/golang/go/issues/27227#issuecomment-459171581)", January 2019 diff --git a/FileTreeDocumentation.md b/FileTreeDocumentation.md index d8b071f0..2c6a5c2c 100644 --- a/FileTreeDocumentation.md +++ b/FileTreeDocumentation.md @@ -1,85 +1,4 @@ -This page documents the file tree for a source installation of go1.13.1. +The Go wiki on GitHub has moved to go.dev (#61940). -``` -$ tree -d -L 2 /usr/lib/go1.13.1 | head -/usr/lib/go1.13.1 -`-- go - |-- api - |-- bin - |-- doc - |-- lib - |-- misc - |-- pkg - |-- src - `-- test -$ -``` +Try or . -api contains data for Go's API checker - -``` -$ ls $GOROOT/api -README go1.10.txt go1.13.txt go1.4.txt go1.7.txt go1.txt -except.txt go1.11.txt go1.2.txt go1.5.txt go1.8.txt next.txt -go1.1.txt go1.12.txt go1.3.txt go1.6.txt go1.9.txt -$ -``` - -bin contains the go and gofmt executables - -``` -$ ls -l $GOROOT/bin -total 11576 --rwxr-xr-x 1 root root 9652760 Oct 2 03:02 go --rwxr-xr-x 1 root root 2197756 Oct 2 03:02 gofmt -$ -``` - -doc contains .css, .go, .html, .js, and .png files - -lib contains the compressed time zone database - -``` -$ tree $GOROOT/lib | head -n 5 -/usr/lib/go1.13.1/go/lib -`-- time - |-- README - |-- update.bash - `-- zoneinfo.zip -$ -``` - -misc contains files pertaining to specific build modes and platforms - -``` -$ tree -d -L 1 $GOROOT/misc | head -n 12 -/usr/lib/go1.13.1/go/misc -|-- android -|-- arm -|-- cgo -|-- chrome -|-- ios -|-- linkcheck -|-- nacl -|-- reboot -|-- swig -|-- trace -`-- wasm -$ -``` - -pkg contains libs, header files, compiled object files, and executables - -``` -$ tree -d -L 1 $GOROOT/pkg | head -n 6 -/usr/lib/go1.13.1/go/pkg -|-- include -|-- linux_386 -|-- linux_386_dynlink -|-- obj -`-- tool -$ -``` -src contains the go1.13.1 source code - -test contains tests of the Go toolchain and runtime \ No newline at end of file diff --git a/FreeBSD.md b/FreeBSD.md index 05acc729..18f4b5c1 100644 --- a/FreeBSD.md +++ b/FreeBSD.md @@ -1,18 +1,4 @@ -# Go on FreeBSD +The Go wiki on GitHub has moved to go.dev (#61940). -| **Kernel version** | **Architectures** | **Initial support version** | **Final support version** | -|:-------------------|:--------------------------------|:----------------------------|:--------------------------| -| 14-CURRENT | amd64, 386, arm, arm64, riscv64 | _**_ _***_ | | -| 13-STABLE | amd64, 386, arm, arm64, riscv64 | _**_ _***_ | | -| 12-STABLE | amd64, 386, arm, arm64 | Go 1.12 _**_ | | -| 11-STABLE (EOL) | amd64, 386, arm, 386 | Go 1.7 | Go 1.19.x | -| 10-STABLE (EOL) | amd64, 386, arm, 386 | Go 1.3 _*_ | Go 1.12.4 | -| 9-STABLE (EOL) | amd64, 386 | Go 1 _*_ | Go 1.9.7 | -| 8-STABLE (EOL) | amd64, 386 | Go 1 _*_ | Go 1.9.7 | -| 7-STABLE (EOL) | amd64, 386 | Go 1 | Go 1.1.2 | +Try or . -_*_ Go 1.5 or above is recommended. - -_**_ Go versions prior to 1.20 require a kernel with `options COMPAT_FREEBSD11` config (this is the default). 64-bit inode aware system calls are available since https://go.dev/cl/143637. See https://go.dev/issues/22447. - -_***_ Go 1.20 is the first version to support freebsd/riscv64. \ No newline at end of file diff --git a/FromXToGo.md b/FromXToGo.md index a6e783de..0f3fd29c 100644 --- a/FromXToGo.md +++ b/FromXToGo.md @@ -1,77 +1,4 @@ -This page links to blog posts, videos, and slide decks discussing moving a code base to Go from some other language. +The Go wiki on GitHub has moved to go.dev (#61940). -# Python -* [Disqus: Trying out this Go thing](https://blog.disqus.com/trying-out-this-go-thing) -* [Rackspace: Making OpenStack-Powered Rackspace Cloud Files Buzz With Hummingbird](https://blog.rackspace.com/making-openstack-powered-rackspace-cloud-files-buzz-with-hummingbird/) -* [Repustate: From Python to Go: migrating our entire API](https://www.repustate.com/blog/migrating-entire-api-go-python/) -* [Spacemonkey: Python to Go](https://www.spacemonkey.com/blog/posts/go-space-monkey) -* [Why I went from Python to Go (and not node.js)](http://jordanorelli.com/post/31533769172/why-i-went-from-python-to-go-and-not-nodejs) -* [How to Convince Your Company to Go With Golang](https://sendgrid.com/blog/convince-company-go-golang/) -* [5 Reasons Why We switched from Python To Go](https://medium.com/@tigranbs/5-reasons-why-we-switched-from-python-to-go-4414d5f42690) -* [Stream: Why we switched from Python to Go](https://getstream.io/blog/switched-python-go) -* [Code Migration in Production: Rewriting the Sharding Layer of Uber’s Schemaless Datastore](https://eng.uber.com/schemaless-rewrite/) -* [Learning Go by porting a medium-sized web backend from Python](https://benhoyt.com/writings/learning-go/) +Try or . -# Node - -* [Digg](https://medium.com/@theflapjack103/the-way-of-the-gopher-6693db15ae1f#.yw5lk8t25) -* [Uber](https://www.infoq.com/articles/podcast-matt-ranney) (audio) -* [Apex/TJ Holowaychuk](https://medium.com/@tjholowaychuk/farewell-node-js-4ba9e7f3e52b#.3hjxf6pbp) -* [ScaleDrone migrated all websocket servers from Node.js to Go](http://blog.scaledrone.com/posts/nodejs-to-go) -* [From Node.js To Go, Why One Startup Made The Switch](http://thenewstack.io/from-node-js-to-go-why-one-startup-made-the-switch/) -* [Why did Koding switch from Node.js to Go?](https://www.quora.com/Why-did-Koding-switch-from-Node-js-to-Go) -* [Letting Go of Node.js](http://blog.davebalmer.com/letting-go-of-node-js/) -* [Our Experience with Golang](https://www.upguard.com/blog/our-experience-with-golang) -* [Interview with Steve Kaliski, CTO of Bowery - The tech stack that powers Bowery, Moving from Node.js to Go lang and more](https://hashnode.com/post/interview-with-steve-kaliski-cto-of-bowery-the-tech-stack-that-powers-bowery-moving-from-nodejs-to-go-lang-and-more-ciibz8dmn001lj3xt468g5k78) - -# C++ - -* [dl.google.com](https://talks.golang.org/2013/oscon-dl.slide#1) by Brad Fitzpatrick -* [Flywheel: Google's mobile image compression proxy](http://matt-welsh.blogspot.nl/2013/08/rewriting-large-production-system-in-go.html) -* [Fulfilling a Pikedream: the ups of downs of porting 50k lines of C++ to Go](https://togototo.wordpress.com/2015/03/07/fulfilling-a-pikedream-the-ups-of-downs-of-porting-50k-lines-of-c-to-go/) - -# Ruby - -* [Book: From Ruby to Golang](https://leanpub.com/rb2go) -* [Toggl: Moving to Go](https://blog.toggl.com/2012/09/moving-to-go/) -* [Iron.io: How We Went from 30 Servers to 2: Go](https://www.iron.io/how-we-went-from-30-servers-to-2-go/) -* [Parse: How We Moved Our API From Ruby to Go and Saved Our Sanity](http://blog.parse.com/learn/how-we-moved-our-api-from-ruby-to-go-and-saved-our-sanity/) -* [Timehop: Why Timehop Chose Go to Replace Our Rails App](https://medium.com/building-timehop/why-timehop-chose-go-to-replace-our-rails-app-2855ea1912d) -* [Scout App: FROM RUBY TO GO: A REWRITE FOR THE FUTURE](http://blog.scoutapp.com/articles/2014/09/25/from-ruby-to-go-a-rewrite-for-the-future) -* [Steven Yue: From Ruby's Grape to Martini in Go for Building Web API Server](http://stevenyue.com/blogs/from-rubys-grape-to-martini-in-go-for-building-web-api-server/) -* [Soundcloud: Go at Soundcloud](https://developers.soundcloud.com/blog/go-at-soundcloud) -* [My impressions of Go](http://blog.bensigelman.org/post/56158760736/golang-impressions) -* [Our Experience with Golang](https://www.upguard.com/blog/our-experience-with-golang) -* [Rewriting our web analytics tracking infrastructure in Go](https://engineering.skroutz.gr/blog/rewriting-web-analytics-tracking-in-go/) - -# Java -* [From Java to Go](https://gquintana.github.io/2017/01/15/From-Java-to-Go.html) -* [Why one developer switched from Java to Google Go](http://www.javaworld.com/article/2459212/scripting-jvm-languages/why-one-developer-switched-from-java-to-google-go.html) - -# Common Lisp -* [A comparison of three programming languages for a full-fledged next-generation sequencing tool](https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-019-2903-5) -* [Comparing Ease of Programming in C++, Go, and Java for Implementing a Next-Generation Sequencing Tool](https://doi.org/10.1177%2F1176934319869015) - -# .NET -* [Why I Left the .NET Framework](http://blog.jonathanoliver.com/why-i-left-dot-net/) - -# Scala -* [CrowdStrike: Moving a Team from Scala to Go](http://jimplush.com/talk/2015/12/19/moving-a-team-from-scala-to-golang/) -* [Making the move from Scala to Go, and why we’re not going back](https://movio.co/blog/migrate-Scala-to-Go/) - -# PHP -* [Switching from PHP to Go (read comments section)](https://www.reddit.com/r/golang/comments/3wfnru/switching_from_php_to_go/) -* [A Journey into Microservices](https://sudo.hailoapp.com/services/2015/03/09/journey-into-a-microservice-world-part-1/) -* [ARDUINO WEB ARCHITECTURE, BACK TO THE FUTURE](https://blog.arduino.cc/2015/04/16/arduino-web-architecture-back-to-the-future/) -* [Marco switched to GoLang from PHP and Saved Money, why not you ?!](http://phpmagazine.net/2015/02/marco-switched-to-golang-from-php-and-saved-money-why-not-you.html) -* [Moving from PHP (Laravel) to Go](https://dannyvankooten.com/laravel-to-golang/) -* [When All You Have is an ElePHPant (Slides from ConFoo 2016)](https://www.ramblinations.com/when-all-you-have-is-an-elephpant) - -# Perl -* [How We Migrate From Perl to Golang](https://medium.com/@alvintz.v/how-we-migrate-from-perl-to-golang-1520a4951392) - -# Haskell -* [Golang’s Real-time GC in Theory and Practice](https://blog.pusher.com/golangs-real-time-gc-in-theory-and-practice/) - -# Clojure -* [Rewriting an API Gateway Service from Clojure to Golang: AppsFlyer Experience Report](https://www.infoq.com/articles/api-gateway-clojure-golang) \ No newline at end of file diff --git a/Frozen.md b/Frozen.md index 576bdc44..f96b1bb8 100644 --- a/Frozen.md +++ b/Frozen.md @@ -1,33 +1,4 @@ -Sometimes a package reaches the end of its development cycle and is considered complete. It continues to be maintained, meaning regressions or breakages are fixed, but the scope becomes frozen and no new features are meant to be accepted. +The Go wiki on GitHub has moved to go.dev (#61940). -Freezing a package is a message primarily for developers and contributors to the package, not users. It does not imply that the package should not be used. For that, see the ["Deprecated" convention](Deprecated). +Try or . -To signal that a package is frozen and is not accepting new features, add a paragraph to its doc comment stating that, and a recommendation on where to look for and where to contribute new features, if applicable. - -## Examples - -``` -// The syslog package is frozen and is not accepting new features. -// Some external packages provide more functionality. See: -// -// https://pkg.go.dev/search?q=syslog -``` - -``` -// The smtp package is frozen and is not accepting new features. -// Some external packages provide more functionality. See: -// -// https://pkg.go.dev/search?q=smtp -``` - -``` -// The net/rpc package is frozen and is not accepting new features. -``` - -``` -// The testing/quick package is frozen and is not accepting new features. -``` - -``` -// The text/tabwriter package is frozen and is not accepting new features. -``` diff --git a/Fuzzing-trophy-case.md b/Fuzzing-trophy-case.md index dfd84da8..34b262e3 100644 --- a/Fuzzing-trophy-case.md +++ b/Fuzzing-trophy-case.md @@ -1,32 +1,4 @@ -# Fuzzing trophy case - -This page collects issues that have been discovered using [Go's native fuzzing](https://github.com/golang/go/issues/44551). - -## Contributing - -If native fuzzing uncovered a bug in your project, please consider adding it to this list by editing this Wiki page directly, or by reaching out to katie@golang.org with the bug you'd like to share. - -_Note: If you think the bug is a security issue, please report it responsibly to the respective team, and do not include it in this list until public disclosure._ - -## Trophies - - -### Standard Library -* [go/scanner: inconsistent handling of NUL bytes in 1.17](https://github.com/golang/go/issues/46855) -* [time: ParseDuration can panic on invalid input](https://github.com/golang/go/issues/46883) - -### Other projects -* [go-yaml/yaml/v3: yaml.Unmarshal() crashes on "#\n - - QI\xd7"](https://github.com/go-yaml/yaml/issues/744) -* [josephburnett/jd: crashes when validating JSON Patch test/replace operation](https://github.com/josephburnett/jd/commit/7064efc5df7c899ffc53b45be8915e3f4edc1684) -* [josephburnett/jd: JSON Patch to void failing round-trip](https://github.com/josephburnett/jd/commit/bd2fc2657f56c7c1f70a5971c18be32365afd1c7) -* [kokes/smda: nil pointer error](https://github.com/kokes/smda/commit/b41ac00b5f5acba60d93076347fc73fe2fbca340) -* [kokes/smda: out of bounds error](https://github.com/kokes/smda/commit/2c2548f211a1ed2c3547407e0b420e4340612278) -* [mvdan.cc/sh: syntax.Quote failed to quote the empty string](https://github.com/mvdan/sh/commit/92eab20da20af9c4005294abf937e387d87c8407) -* [mvdan.cc/sh: syntax.Quote misused `\x` escape sequences in mksh](https://github.com/mvdan/sh/commit/8bd780f971469bece51617a53da0e1c700c4a5b8) -* [mvdan.cc/sh: syntax.Quote can't quote the `0xFFFE` and `0xFFFF` runes in mksh](https://github.com/mvdan/sh/commit/6ff55fb976f3c39d1a382ff5af616c3665c7e501) -* [pelletier/go-toml: index out of range error in expect function](https://github.com/pelletier/go-toml/issues/561) -* [swaggest/form: panic on invalid keys in request](https://github.com/swaggest/form/issues/4) -* [yuin/goldmark: corner case errors](https://github.com/yuin/goldmark/issues/245) -* [DataDog/datadog-agent: fix edge case in tags normalization](https://github.com/DataDog/datadog-agent/pull/13235) +The Go wiki on GitHub has moved to go.dev (#61940). +Try or . diff --git a/GOPATH.md b/GOPATH.md index 8cc58aa6..3c5c2f30 100644 --- a/GOPATH.md +++ b/GOPATH.md @@ -1,78 +1,4 @@ -## GOPATH variable +The Go wiki on GitHub has moved to go.dev (#61940). -Go development using dependencies beyond the standard library is done [using Go modules](https://go.dev/blog/using-go-modules). When using Go modules, the GOPATH variable (which defaults to `$HOME/go` on Unix and `%USERPROFILE%\go` on Windows) is used for the following purposes: +Try or . - - The `go install` command installs binaries to `$GOBIN`, which defaults to `$GOPATH/bin`. - - The `go get` command caches downloaded modules in `$GOMODCACHE`, which defaults to `$GOPATH/pkg/mod`. - - The `go get` command caches downloaded checksum database state in `$GOPATH/pkg/sumdb`. - -See the [go command documentation](https://pkg.go.dev/cmd/go#hdr-GOPATH_environment_variable) for full details about the GOPATH variable. The rest of this page concerns the GOPATH development mode, which is now deprecated. - -## GOPATH development mode - -Before Go modules, Go development using dependencies used “GOPATH development mode,” or “GOPATH mode” for short. In GOPATH mode, the `go` command used the GOPATH variable for the following purposes: - - - The `go install` command installed binaries to `$GOBIN`, which defaults to `$GOPATH/bin`. - - The `go install` command installed the compiled package file for `import "example.com/y/z"` to `$GOPATH/pkg/example.com/y/z.a`. - - The `go get` command downloaded source code satisfying `import "example.com/y/z"` to `$GOPATH/src/example.com/y/z`. - -## Deprecating and removing GOPATH development mode - -Go modules are the replacement for GOPATH development mode to add the concept of a package version throughout the Go ecosystem. - -The transition from GOPATH development mode to Go modules has been gradual, spread across many Go releases: - -- **Go 1.11 (August 2018)** introduced the `GO111MODULE` variable, which defaulted to `auto`. - With `GO111MODULE=off`, the `go` command used GOPATH mode always. - With `GO111MODULE=on`, the `go` command used module mode always. - With `GO111MODULE=auto` (or leaving `GO111MODULE` unset), the `go` command decided the mode based on the current directory. If the current directory was _outside_ `$GOPATH/src` and was within a source tree with a `go.mod` file in its root, then the `go` command used Go module mode. Otherwise the `go` command used GOPATH mode. This rule ensured that all commands run in `$GOPATH/src` were unaffected in `auto` mode but let users experiment with modules in other directories. - -- **Go 1.13 (August 2019)** adjusted `GO111MODULE=auto` mode to remove the `$GOPATH/src` restriction: if a directory inside `$GOPATH/src` has a `go.mod` file, commands run in or below that directory now use module mode. This allows users to continue to organize their checked-out code in an import-based hierarchy but use modules for individual checkouts. - -- **Go 1.16 (February 2021)** will change the default to `GO111MODULE=on`, using module mode always. That is, GOPATH mode will be disabled entirely by default. Users who need one to use GOPATH mode for one more release can set `GO111MODULE=auto` or `GO111MODULE=off` explicitly. - -- **Go 1.NN (???)** will remove the `GO111MODULE` setting and GOPATH mode entirely, using module mode always. - -Note that removing GOPATH development mode does _not_ mean removing the GOPATH variable. It will still be used for the purposes listed at the top of this page. - -## FAQ - -### Is the GOPATH variable being removed? - -No. The GOPATH variable (set in the environment or by `go env -w`) is **not** being removed. It will still be used to determine the default binary install location, module cache location, and checksum database cache location, as mentioned at the top of this page. - -### Can I still write code in GOPATH/src/import/path? - -Yes. Many Go developers appreciate the structure that this convention provides and check out their module repositories into it. All your code needs to get started with modules is a `go.mod` file. See [`go mod init`](https://pkg.go.dev/cmd/go#hdr-Initialize_new_module_in_current_directory). - -### How can I compile one repo in GOPATH/src against changes made in another? - -If you want to use unpublished changes in one module when building another, you can add a `replace` line to the other module’s `go.mod`. - -For example, if you have checked out `golang.org/x/website` and `golang.org/x/tools` to `$GOPATH/src/golang.org/x/website` and `$GOPATH/src/golang.org/x/tools`, then to make your local builds of `website` automatically use changes in `tools`, you would add this to `$GOPATH/src/golang.org/x/website/go.mod`: - - replace golang.org/x/tools => ../tools - -Of course, `replace` directives know nothing about `$GOPATH`. The same line would work fine if you had checked the two out into `$HOME/mycode/website` and `$HOME/mycode/tools`. - -### Why is GOPATH development mode being removed? - -At its core, GOPATH development mode essentially supplies all those kinds of `replace` lines automatically, so that the code you build for dependencies is the code you happen to have checked out on your computer. That means your build is affected by old checkouts you happen to have lying around that you might have forgotten about. It means that the build you get on one machine can be different from another, even starting with the same version of the same top-level repo. And it means that the builds you get can be different from the ones another developer in the same project gets. Go modules address all these reproducibility concerns. The root cause of all these problems is that GOPATH mode does not have any concept of a package _version_. - -In addition to reproducibility, Go modules provide a clear way to handle proxying and secure downloads. When you `git clone` a project and then grab its dependencies, those dependencies are being cryptographically checked (using the `go.sum` file) to make sure they're the same bits the original developer used. The only trusted part is the top-level `git clone`. Here again, this is only possible because Go modules, in contrast to GOPATH mode, have a concept of a package version. - -And for future evolution of Go itself, modules clearly mark which version of the Go language a particular tree of files is written in. This makes it possible to disable problematic features—for example, `string(1)`, which many people think produces `"1"` but actually produces `"\x01"` (Ctrl-A)—in later versions of Go while keeping older programs building (because they are explicitly marked as having been written for the older version of Go). - -There are more examples like these. - -None of this is possible with GOPATH development mode as it exists today. We can't move the ecosystem forward and start really depending on these important properties of Go modules without retiring GOPATH mode. - -(You might also ask: why not just add those things to GOPATH mode? The answer is: we did, and the result is Go modules.) - -### When was it decided to deprecate GOPATH development mode? - -The [original plan](https://go.dev/blog/modules2019) was to deprecate GOPATH mode in Go 1.13, but we wanted to take extra time to make modules even more robust for as many Go users as possible, so the deprecation was pushed back from that release. Discussion on [issue #41330](https://go.dev/issue/41330) and in the golang-tools group did not identify any remaining blockers for deprecating GOPATH, so it is now scheduled for Go 1.16, with removal in a future release, as stated in the timeline above. - -### What if I have more questions about moving from GOPATH development mode to Go modules? - -See [golang.org/help](https://go.dev/help) for a list of resources. If none of those are appropriate, feel free to [file an issue](https://go.dev/issue) here. We want everyone to be successful adopting Go modules. diff --git a/Gardening.md b/Gardening.md index 51dd5414..f1ba3873 100644 --- a/Gardening.md +++ b/Gardening.md @@ -1,61 +1,4 @@ -# Gardening +The Go wiki on GitHub has moved to go.dev (#61940). -## What is gardening? +Try or . -"Gardening" in open source projects refers to the background maintenance tasks done to keep the project healthy & growing & nice looking. - -This page lists common Go gardening tasks. - -## Access - -If you've been regularly active in the Go community for some time, feel free to ask for Gerrit and/or Github access to modify things. - -See https://go.dev/wiki/GerritAccess and https://go.dev/wiki/GithubAccess - -## Gardening Tasks - -Before doing any gardening work, especially on the issue tracker, remember to familiarize yourself with the issues life-cycle, described here: [Handling Issues - Issue States](https://github.com/golang/go/wiki/HandlingIssues#issue-states). - -### Fix red - -Look at https://build.golang.org/ --- is anything red? Fix or file bugs or nag people. The build dashboard should never be red, even occasionally. If the tree is red, people can't work effectively because TryBots and such will just report failures, masking other problems. - -### Triage new bugs - -Look at the [untriaged issues](https://github.com/golang/go/issues?q=is%3Aopen+is%3Aissue+-label%3ANeedsInvestigation+-label%3ANeedsFix+-label%3ANeedsDecision+-label%3AWaitingForInfo+-label%3AGo2+-label%3AProposal+-label%3ACherryPickCandidate+-label%3ACherryPickApproved+no%3Aassignee+created%3A%3E2019-01-01+-label%3Agopls+-label%3Apkgsite). For Go, we use the presence of certain labels (`Needs*` or `WaitingForInfo`) to indicate that an issue has been triaged. Issues labeled `Go2`, `Proposal`, `CherryPickCandidate`, `gopls`, `pkgsite` have their own, separate triage queues and can be skipped. - -While triaging the bug: - -* is it a duplicate? Close it, referencing the dup. -* is it a Question rather than a bug? Reply with something like "For questions about Go, see https://go.dev/wiki/Questions". -* is the subject the correct format? It should start with the package path and a colon: "net/http: fix crash in Server during foo operation". -* is it in a subrepo? Leave the milestone as `Unreleased` unless it's a subrepo that goes into a release, like `http2`. -* if it is a regression and you can reproduce it, use `git bisect` to find the bad commit (optional but very helpful). -* does the relevant package [have a primary owner](https://dev.golang.org/owners)? Mention them in a comment. If not, add the `help wanted` label. -* if the relevant package has no owner, but appears to be complex and deeply technical in nature, add the `ExpertNeeded` label. - -When the issue has been triaged, add an appropriate label (per https://go.dev/wiki/HandlingIssues) to mark it as such. - -### WaitingForInfo - -Find bugs that are in state WaitingForInfo (https://github.com/golang/go/labels/WaitingForInfo) and ping them, remove the label when replies arrive, or close the bugs if a reply never arrived. - -### "Unplanned" bugs - -["Unplanned" issues](https://github.com/golang/go/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aopen%20milestone%3AUnplanned%20sort%3Aupdated-asc%20-label%3AGo2%20-label%3ALanguageChange) have a habit of being neglected. Check out old ones and see if they're easily fixable (and can be moved to a Go1.n or Go 1.nMaybe milestone), or should be closed. - -### Pending CLs - -[Review the format of commit messages](https://go.dev/doc/contribute#commit_messages) and presence of tests and formatting of code and typos/grammar in incoming pending CLs. All of that can be done without determining the correctness of the change itself. See https://dev.golang.org/release for the list of pending CLs. - -Once it has a +1, the owner of that area can give it a +2. - -Read a +1 as meaning "triaged", or "not obviously wrong". If it has tests, is formatted properly (references a bug number, probably), and is ready for more review, give it a +1. - -### Pending CLs: ask about tests - -If a new CL arrives without a test, but could/should have a test, ask if they could add a test. Or suggest how. - -### Pending CLs: run TryBots - -If you have access (see https://go.dev/wiki/GerritAccess) to run the TryBots and you see a CL with plausible (and non-malicious) code, kick off the TryBots. (We've never seen malicious code trying to escape our TryBot sandboxes, but that's why it's not automatic yet. Please alert us if you see something.) diff --git a/GcToolchainTricks.md b/GcToolchainTricks.md index da391a78..fdb38dd2 100644 --- a/GcToolchainTricks.md +++ b/GcToolchainTricks.md @@ -1,108 +1,4 @@ -This page documents some less well-known (perhaps advanced) tricks for the ` gc ` toolchain (and the Go tool). +The Go wiki on GitHub has moved to go.dev (#61940). -# C code without ` cgo ` +Try or . -### Use ` syso ` file to embed arbitrary self-contained C code -Basically, you write your assembly language in GNU as(1) format, but make sure -all the interface functions are using Go's ABI (everything on stack, etc., please read [Go 1.2 Assembler Introduction](https://go.dev/doc/asm) for more details). - -The most important step is compiling that file to file.syso (` gcc -c -O3 -o file.syso file.S `), -and put the resulting syso in the package source directory. -And then, suppose your assembly function is named Func, you need one stub -[cmd/asm](https://pkg.go.dev/cmd/asm) assembly file to call it: -```as -TEXT ·Func(SB),$0-8 // please set the correct parameter size (8) here - JMP Func(SB) -``` -then you just declare Func in your package and use it, go build will be able to -pick up the syso and link it into the package. - -Notes: - * The binary produced won't use cgo, and the overhead is just an unconditional JMP that could be perfectly branch predicted. But, please be aware that because it doesn't use cgo, your assembly function is running on Go stack, and it **shouldn't use too much stack** (a safe value is less than ~100 bytes) or terrible things will happen. For compute kernels, this requirement isn't too restricting. - * Please make sure you‘ve included all library dependencies in your C code. ` libc ` is not available, and most notably, ` libgcc ` is also not available (esp. when you're using gcc ` __builtin_funcs `, please use ` nm(1) ` to double-check that your file doesn't contain any undefined symbols). - * It's also possible to call back Go functions from C code, but this is left as an exercise for the reader. - * this trick is supported on all Go 1.x releases. - * the Go linker is pretty capable in that you just need to prepare .syso file for each architecture, not for each OS/Arch combination (assuming you don't use OS-specific constructs, obviously), and the Go linker is perfectly capable to link, for example, Mach-O object files into ELF binaries. So be sure to name your syso file with names like ` file_amd64.syso `, ` file_386.syso `. - -# Bundle data into Go binary -There are a lot of ways to bundle data in Go binary, for example: - * ` zip ` the data files, and append the zip file to end of Go binary, then use ` zip -A prog ` to adjust the bundled zip header. You can use ` archive/zip ` to open the program as a zip file, and access its contents easily. There are existing packages that helps with this, for example, https://pkg.go.dev/bitbucket.org/tebeka/nrsc; This requires post-processing the program binary, which is not suitable for non-main packages that require static data. Also, you must collect all data files into one zip file, which means that it's impossible to use multiple packages that utilize this method. - * Embed the binary file as a ` string ` or ` []byte ` in Go program. This method is not recommended, not only because the generated Go source file is much larger than the binary files themselves, also because static large ` []byte ` slows down the compilation of the package and the ` gc ` compiler uses a lot of memory to compile it (this is a known bug of ` gc `). For example, see the [tools/godoc/static](https://pkg.go.dev/golang.org/x/tools/godoc/static) package. - * use similar ` syso ` technique to bundle the data. Precompile the data file as syso file using GNU ` as(1) `'s ` .incbin ` pseudo-instruction. - -The key trick for the 3rd alternative is that the linker for the ` gc ` toolchain has the ability to link COFF object files of a different architecture into the binary without problem, so you don't need to provide syso files for all supported architectures. As long as the syso file doesn't contain instructions, you can just use one to embed the data. - -The assembly template to generate the COFF .syso file: -```as -/* data.S, as -o data.syso */ -.section .rdata,"dr" /* put in COFF section .rdata */ -.globl _bindataA /* no longer need to prepend package name here */ -.globl _ebindataA -_bindataA: -.incbin "dataA" -_ebindataA: - -.globl _bindataB /* no longer need to prepend package name here */ -.globl _ebindataB -_bindataB: -.incbin "dataB" -_ebindataB: -``` - -And two other files, first a Plan 9 C source file that assembles the slice for Go: -```c -/* slice.c */ -#include "runtime.h" -extern byte _bindataA[], _bindataB[], _ebindataA, _ebindataB; - -void ·getDataSlices(Slice a, Slice b) { - a.array = _bindataA; - a.len = a.cap = &_ebindataA - _bindataA; - b.array = _bindataB; - b.len = b.cap = &_ebindataB - _bindataB; - FLUSH(&a); - FLUSH(&b); -} -``` - -And finally, the Go file that uses the embedded slide: -```go -/* data.go */ -package bindata - -func getDataSlices() ([]byte, []byte) // defined in slice.c - -var A, B = getDataSlices() -``` - -Note: you will need an ` as(1) ` capable of generating the COFF syso file, you -can build one easily on Unix: -``` -wget http://ftp.gnu.org/gnu/binutils/binutils-2.22.tar.bz2 # any newer version also works -tar xf binutils-2.22.tar.bz2 -cd binutils-2.22 -mkdir build; cd build -../configure --target=i386-foo-pe --enable-ld=no --enable-gold=no -make -# use gas/as-new to assemble your data.S -# all the other file could be discarded. -``` - -**Drawback** of this issue is that it seems incompatible to cgo, so only use it when you don't -use cgo, at least for now. I (minux) is working on figuring out why they're incompatible. - -# Including build information in the executable - -The gc toolchain linker, [cmd/link](https://pkg.go.dev/cmd/link), provides a `-X` option that may be used to record arbitrary information in a Go string variable at link time. The format is `-X importpath.name=val`. Here `importpath` is the name used in an import statement for the package (or `main` for the main package), `name` is the name of the string variable defined in the package, and `val` is the string you want to set that variable to. When using the go tool, use its `-ldflags` option to pass the `-X` option to the linker. - -Let's suppose this file is part of the package `company/buildinfo`: - -```go -package buildinfo - -var BuildTime string -``` - -You can build the program using this package using `go build -ldflags="-X 'company/buildinfo.BuildTime=$(date)'"` to record the build time in the string. (The use of `$(date)` assumes you are using a Unix-style shell.) - -The string variable must exist, it must be a variable, not a constant, and its value must not be initialized by a function call. There is no warning for using the wrong name in the `-X` option. You can often find the name to use by running `go tool nm` on the program, but that will fail if the package name has any non-ASCII characters, or a `"` or `%` character. \ No newline at end of file diff --git a/GccgoCrossCompilation.md b/GccgoCrossCompilation.md index 55a029c5..58f07dce 100644 --- a/GccgoCrossCompilation.md +++ b/GccgoCrossCompilation.md @@ -1,110 +1,4 @@ -# Introduction +The Go wiki on GitHub has moved to go.dev (#61940). -If you want to run your Go programs on a platform that is not supported by the standard Go compiler _gc_ you can build a version of the GCC compiler that targets your desired target platform, since GCC supports many more platforms. This is possible because there is a Go frontend to GCC named [gccgo](https://github.com/golang/gofrontend). +Try or . - -# Details - -## Definitions - * **Build** This is the computer where you are building the cross-compiler. - * **Host** The computer that will run the cross-compiler once it's built. This is usually the same as Build. - * **Target** This is the destination system, where you want the cross-compiled program to run. - -More definitions and complex cross situations can be found at the [Wikipedia article](http://en.wikipedia.org/wiki/Cross_compiler). - -## Go tools and gccgo -You will later need to source code to the Go tool, so you might as well uninstall the version you have installed from your package manager to avoid confusion (fully optional tho). Also build & install gccgo targeting host(!, that's right, you need a gcco compiling for not only target but one for host). - - * [Installing Go from source](https://go.dev/doc/install/source) - * [Official Go documentation](https://go.dev/doc/install/gccgo) - -## Build the cross-compiler - -### Build -First you have to build your cross-compiling version of GCC. This is complex process as it requires several stages with bootstrapping since there are mutual dependency relations between GCC and libc implementations. A very fine tutorial on how to build a GCC cross-toolchain with eglic (works with glibc too) was written by Jim Blandy and posted at eglibc's mailinglist [patches Cross-building instructions](http://www.eglibc.org/archives/patches/msg00078.html). In the final stage where the full GCC is built, simply configure script with _--enable-languages=c,c++,go_ (see [official Go documentation](https://go.dev/doc/install/gccgo)). - -You can use the [ewxb\_gcc\_cross-compiler\_builder](https://github.com/erikw/ewxb_gcc_cross-compiler_builder) script as a starting point. Don't expect that script to work out of the box, but rather as a hint to which steps you're likely to take when building your x-toolchain. - -If you're lucky enough and want a version of GCC that is not bleeding edge (which you might want to have the latest Go features) you can use a cross-compiler builder to ease the configuration e.g. [crosstool-NG](http://crosstool-ng.org/) that lets you configure GCC with a simple TUI menu. - -Newer versions of crosstool-NG can build the go language by enabling ```CT_EXPERIMENTAL``` and ```CT_CC_SUPPORT_GOLANG```. This will automatically add ```go``` to ```--enable-languages```. - -### Symlink -You should now have a bin directory with files with names like "` -gcc", "` -gnu-gccgo" etc. Because the go build tool does not allow you to specify file-names of the compilers to use (only statically supports the strings 'gc' and 'gccgo') it will look in your $PATH envvar for the first file named 'gccgo' and 'gcc'. You will therefore have to add this directory as an overlay by setting it to be the first one in $PATH when you want to use the cross-compiler and not your normal gcc binary on your system. Since the go tool looks for a binary named _gccgo_ you'll have to make some symlinks for the tools you want it to find. - -``` - $ cd path/to/cross-comp-gcc/bin - $ ln -s --gnu-gcc gcc - $ ln -s --gnu-gccgo gccgo - $ ln -s --gnu-ar ar - $ export PATH="path/to/crosscomp-gcc/bin:$PATH" # Do this whenever you want to use the cross-compilers targeting your target instead of the system default targeting host. -``` - -etc. - -With $TARGET set to the target architecture and $PREFIX set to the destination path of the built files, you can make the symlinks with: - -``` -#!/usr/bin/env bash - -cd $PREFIX/bin -for file in $(find . -type f); do - tool_name=$(echo $file | sed -e "s/${TARGET}-\(.*\)$/\1/") - ln -sf "$file" "$tool_name" -done -``` - -### Test -When the cross-compiler is build you should test that it works, both for a simple C program and a simple Go program. - -``` - $ gccgo -Wall -o helloworld helloworld.go - $ file helloworld # verify that the architecture of the binary is the desired target and not a binary that can run on your host machine. - $ helloworld - $ -``` - -### Gotchas - -If you haven't compiled a shared object of the go library, _libgo_, for your target you might want to compile your Go programs statically, just like _gc_ does, to include all what is needed to run your program. Do this by adding the _-static_ switch to gccgo. If you're unsure how your produced ELF file is linked, inspect it with _readelf -d ``_ or _objdump -T ``_. - - -## Build a cross-gccgo aware version of the Go tool -### Assumptions - * Assuming that you've followed the instructions on [Installing Go from source](https://go.dev/doc/install/source) you should have a checked out version of the go source at _$GOROOT_. - * Envvar _$GOROOT_ is set. - * The envvars _$GOARCH_ and _$GOOS_ represent the **target** architecture and operating system. Figure these out and set them to these values when you want to cross-compile. - -### Build -You can specify the compiler to use when building with the go tool with _go build -compiler gccgo ` `_. This is however not enough. If you have set _$GOARCH_ and _$GOOS_ to something that is not supported by _gc_ but with _gccgo_ you have to build a special version of the go tool that understands these extra architectures. If you compile another version of the go tool with the go tool but specify to use gccgo targeting your host, the resulting go tool will be able to compile programs with all the architectures supported by gccgo. - -``` - $ cd ~/tmp - $ hg clone ~/src/go # [0] - $ cd go/src/cmd/go - $ go build -o xgo -compiler gccgo . # [1] [2] [3] - $ cp xgo ~/bin/ # Or any directory that is in your $PATH -``` - * ` [0 `] Clone Go source to directory outside $GOROOT. Needed since the cmd/go we're about to compile is handles specially. - * ` [1 `] Here the _gccgo_ that targets **host** must be used, and not the cross-compiling gccgo. Make sure to have you _$PATH_ set correctly for this. - * ` [2 `] Will produce binary named xgo to distinguish from the existing go-binary. Name it to something suitable, e.g. mgo if your target is MIPS. - * ` [3 `] The compilation step (go build) can fail with some compilation errors since gccgo is lagging behind the go project (at least at go mercurial tip 7f2863716967). Fix those errors by commenting out or something more clever and re-compile. - - -## Cross-compile Go programs. - -With your _$PATH_ set to find _xgo\_and the cross-compiling version of_gccgo and _$GOARCH_ set properly you can now cross-compile using the go tool (named xgo). - -``` - $ export PATH="path/to/xgo/:path/to/crosscomp-gccgo/:$PATH" - $ export GOARCH="" - $ export GOOS="" - $ xgo build -compiler gccgo -``` - -## TODO - -Go-programs importing "C" does not seems to work using xgo. Currently blocked by [Go issue#7398](https://github.com/golang/go/issues/7398) - - -This Wiki page was inspired by the lessons learned from "[golang-nuts] Simplification of MIPS cross-compilation?" @ https://groups.google.com/forum/#!topic/golang-nuts/PgyS2yoO2jM \ No newline at end of file diff --git a/GerritAccess.md b/GerritAccess.md index 473a64c5..9053f043 100644 --- a/GerritAccess.md +++ b/GerritAccess.md @@ -1,64 +1,4 @@ -# Gerrit Access +The Go wiki on GitHub has moved to go.dev (#61940). -There are two types of Gerrit access described here, with different powers & responsibilities. Only ask for access if you're an active member of the community. New contributors should participate in the Gerrit code review process for some time before requesting access. +Try or . -(For Github access, see https://go.dev/wiki/GithubAccess) - -## Running TryBots ("may-start-trybots") - -TryBot access lets you kick off a test run of a CL in Gerrit prior to submission (pre-submit testing). -TryBots run in a somewhat-secure and somewhat-isolated environment, -but they're not perfectly security hardened. -You must skim the CL for anything malicious before starting TryBots. - -See [LUCI](https://go.dev/wiki/LUCI#TryBots) for details on triggering TryBots. - -All approvers (see next section) have TryBot access automatically. Others can request TryBot access. See [Requesting Access](#requesting-access) below. - -## Approving CLs ("approvers") - -Approvers can review and submit code changes (CLs), subject to the review rules described below. Being an approver comes with an expectation of responsibility: approvers are people who care about Go and want to help it succeed. An approver is not just someone who can make changes, but someone who has demonstrated their ability to collaborate with the team, get the most knowledgeable people to review code, contribute high-quality code, and follow through to fix issues (in code or tests). - -### Code Review Requirements - -Every CL requires _both_ a code review (Code-Review+2) from an approver and the involvement of two Google employees using Google-secured computers, either as code uploader or as a reviewer voting at least Code-Review+1. Requiring multiple people ensures that code cannot be submitted unilaterally from a single compromised account. The Google employee and hardware requirements further raise the bar: since CLs in many repos are essentially published by Google for download by users at commit time, the Google involvement is to approve this publication. Once a review has a Code-Review+2 and the necessary Google involvement, it can be submitted, by any approver. All these rules are enforced by the Gerrit server. - -A Code-Review+2 vote means that you have read the change and are confident that it is correct and appropriate to submit. Typically, you should only Code-Review+2 code in directories or packages that you "own"; the exception is trivial and obviously correct changes. Note that all user-visible new features or changes—new API, new command-line flags, and so on—need to go through the [proposal process](https://go.dev/s/proposal-process). The CLs should reference the specific accepted proposal [in the commit message](https://github.com/golang/go/wiki/CommitMessage) (“For #NNN.”). - -When adding a Code-Review+2 vote, it is encouraged to also add Run-TryBots+1 and Auto-Submit+1: see the [auto-submit](#auto-submit) section below for details. - -A Code-Review+1 vote means that you have read the change and believe it seems reasonable but aren’t making the definitive judgement that Code-Review+2 indicates. It also means you are confident the change does not introduce any sort of security vulnerability or other clearly inappropriate code change. - -When a change has the appropriate reviews to be submitted, a Submit button appears in Gerrit (for approvers). You should only submit changes with a Code-Review+2 from the owner of that area (maybe you!). - -Approvers can also vote Hold+1 on a CL to mark it as unsubmittable (until that vote is removed). A typical reason might be that we need to wait on the CL for a proposal review, or because the CL needs to be submitted at a certain time: voting Hold+1 ensures that it can still be reviewed, but it won't accidentally be submitted early. - -To request approver access, see [Requesting Access](#requesting-access) below. - -### Auto-Submit - -If you are reviewing a CL and believe it can be approved and submitted as is, -with no further changes, you can use the auto-submit functionality -to run tests and submit the CL if the tests pass. -To do this, vote Code-Review+2 as well as Auto-Submit+1 and Run-TryBot+1. When the tests pass, Gopherbot will submit it. - -More precisely, Gopherbot watches for and automatically submits CLs that - - - have Auto-Submit+1 and TryBot-Result+1 votes, - - have the necessary code reviews, - - have no unresolved comments, - - aren't marked #wait-release, - - and merge cleanly into the current branch head. - -All approvers can add Auto-Submit+1 votes. -An Auto-Submit+1 vote is not carried forward when a patch is reuploaded. - -# Requesting Access - -To get request either of the access types above, file a bug (https://github.com/golang/go/issues/new?title=access:+&body=See+https://go.dev/wiki/GerritAccess) and list and state which access you want, and state the Google account you use to log in to Gerrit. - -Decisions about granting access are made by the Go release team at Google. If your request is declined, it is almost always because you haven't been active enough for them to get a clear enough signal about your work, understanding of project conventions, and so on. Don't lose heart: it can take time to reach that level of familiarity. - -## Once you have access - -Go help garden! See https://go.dev/wiki/Gardening. \ No newline at end of file diff --git a/GerritBot.md b/GerritBot.md index f1372a55..f56a9a86 100644 --- a/GerritBot.md +++ b/GerritBot.md @@ -1,78 +1,4 @@ -GerritBot is a tool used for importing GitHub Pull Requests (PRs) into [Gerrit](https://go-review.googlesource.com) for code review. It was created because the Go team does all its reviews in Gerrit, but we'd like to allow a more common workflow for contributing code via GitHub PRs. +The Go wiki on GitHub has moved to go.dev (#61940). -Table of Contents -================= +Try or . -+ [Workflow](#workflow) -+ [Frequently Asked Questions](#frequently-asked-questions) -+ [Feedback and Bug Reports](#feedback-and-bug-reports) -+ [I'd like to add a feature/fix a bug](#id-like-to-add-a-featurefix-a-bug) - -## Workflow - -+ A user can upload a GitHub PR against any of our GitHub repos just as they would with any other GitHub project that accepts PRs -+ The PR changes will then be imported by GerritBot and a message will be posted to the GitHub PR containing a link to the Gerrit review -+ All comments are handled within Gerrit. Any comments on the GitHub PR will be ignored -+ The PR author can continue to upload commits to the branch used by the PR in order to address feedback from Gerrit -+ Any changes to the commit message must be done by editing the title and description of the GitHub PR, and not via Gerrit or git. (See FAQ below for details). -+ [Draft PRs](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests#draft-pull-requests) are imported as [WIP](https://gerrit-review.googlesource.com/Documentation/intro-user.html) -+ Once the code is ready to be merged, a maintainer will submit the change on Gerrit and GerritBot will close the issue -+ Similarly, if a change is closed or abandoned on Gerrit, the corresponding PR will be closed - -## Frequently Asked Questions - -### I need a Google account to sign up for Gerrit? Why can't I sign in using my GitHub account? - -You need a Gmail or other Google account to [register for Gerrit](https://go-review.googlesource.com/login/). -This is a limitation of the infrastructure that runs our Gerrit instances and is out of our control, plus you already need a Google account to [sign our CLA](https://cla.developers.google.com/clas), a requirement for us to accept your contribution in the first place. - -### I left a reply to a comment in Gerrit but no one but me can see it - -Replies to comments on code in Gerrit are first saved as drafts and need to be published via the “Reply” button. This is to prevent multiple emails per review “session” and is similar to the [pending review workflow](https://help.github.com/articles/reviewing-proposed-changes-in-a-pull-request/) in GitHub. If you see a number next to the “Reply” text in the button, this means you have pending drafts to publish. - -### How does GerritBot determine the final commit message? - -It uses the title and description of the GitHub PR to construct the commit message for the Gerrit change. You can edit this using the GitHub web interface (not Gerrit or git). The PR description is in the first text area in the "Conversation" tab of the GitHub PR. It is editable via "Edit" option on the "..." menu. - -**Note:** Gerrit imports the **plain** text that is viewable as you edit the message in Github, and it does not import the **rendered** text you see in GitHub prior to editing. - -One common area of related confusion is around **issue references**. For example, GerritBot or a human reviewer might ask you to [avoid URLs for issue references](https://go.dev/doc/contribute#ref_issues). In Gerrit, you might see the full URL for an issue, but in the GitHub web interface, you might only see an issue reference like `#12345` and it might be unclear where the URL is coming from. This can be due to confusion between the rendered view in GitHub vs. the underlying raw/plain text. If the GitHub web interface shows something like `Fixes https://github.com/golang/go/issues/12345` while you are **editing the text in GitHub**, change it to something like `Fixes #12345` or `Fixes golang/go#12345` instead. See the [Contribution Guide](https://go.dev/doc/contribute#ref_issues) for more on issue references. - -Once the PR is edited in GitHub, it can take 10 minutes or so before the Gerrit change is updated. - -### What is a CL? What is a Gerrit change? - -CL is short for "change list", which is essentially a patch proposed to be introduced into a repository. The Go project uses Gerrit to carefully review each CL. An example CL is https://go.dev/cl/508475. - -Gerrit change is another term for CL. - -### Can I help review other people's CLs? - -Yes, this is highly encouraged, and a great way to familiarize yourself with Gerrit, the Go project's [code review process](https://go.dev/doc/contribute#review), and the internals of the Go standard library, runtime, compiler, and so on. - -You can browse the currently open CLs [here](https://go-review.googlesource.com/q/status:open+-is:wip) and subscribe for updates to interesting CLs by clicking the star icon. - -You don't need to be an expert in the code to help with initial review triage. See the section on [helping to review CLs](https://github.com/golang/go/wiki/Gardening/#pending-cls) in the [Gardening](https://github.com/golang/go/wiki/Gardening) wiki page for more details. - -### I heard Gerrit requires one commit per change. Can I upload multiple commits to my PR? - -You can upload as many commits as you like. GerritBot will handle squashing your commits into one change that Gerrit can handle. - -### Why is GerritBot the owner of my change? - -This is due to an [open bug](https://bugs.chromium.org/p/gerrit/issues/detail?id=8296) with the way Gerrit handles acting as another user. Once that is fixed, the original author will also be the owner of the change. - -### Can I ask GerritBot to stop posting comments on my PR? - -You can toggle comments from GerritBot by using the `comments` slash command (e.g., `/comments off`). - -## Feedback and Bug Reports - -Please [file an issue](https://github.com/golang/go/issues/new?title=x%2Fbuild%2Fcmd%2Fgerritbot%3A%20%3Cfill%20this%20in%3E) and use the `x/build/cmd/gerritbot:` prefix in the title. - -## I'd like to add a feature/fix a bug - -+ If the feature/bug is non-trivial, please [file an issue](https://github.com/golang/go/issues/new?title=x%2Fbuild%2Fcmd%2Fgerritbot%3A%20%3Cfill%20this%20in%3E) first -+ The code is located at x/build/cmd/gerritbot - ([GitHub](https://github.com/golang/build/tree/master/cmd/gerritbot), - [Gerrit](https://go.googlesource.com/build/+/master/cmd/gerritbot/)) \ No newline at end of file diff --git a/GithubAccess.md b/GithubAccess.md index 38fac145..5b7bb8da 100644 --- a/GithubAccess.md +++ b/GithubAccess.md @@ -1,27 +1,4 @@ -# Github Access +The Go wiki on GitHub has moved to go.dev (#61940). -There are two types of Github access described here, with different powers & responsibilities. Only ask for access if you're an active member of the community. New contributors should participate in the Github & Gerrit review process for some time before requesting access. +Try or . -(For Gerrit access, see https://go.dev/wiki/GerritAccess) - -## Assignees - -The "go-assignees" group is a read-only group granting no special access, other than it allows the users in the group to be assigned issues. - -In general, Go doesn't use the "Assigned to" field of bugs much. Instead, we just leave a comment saying we'll work on it. But if you want this access, reference https://github.com/orgs/golang/teams/go-assignees and your Github username in your issue requesting access. - -## Editors - -The "go-editors" group is the set of people who can edit metadata on issues. - -To request this type of access, reference https://github.com/orgs/golang/teams/go-editors and your Github username in your issue requesting access. - -Please do not edit any field you're not confident about. Feel free to ask for second opinions. - -## Requesting Access - -To get request either of the access types above, file a bug (https://github.com/golang/go/issues/new?title=access:+&body=See+https://go.dev/wiki/GithubAccess) and list and state which access you want (its name and group URL). - -## Once you have access - -Go help garden! See https://go.dev/wiki/Gardening. \ No newline at end of file diff --git a/Go-1.10-Release-Party.md b/Go-1.10-Release-Party.md index 3d6d0b67..a3251dc2 100644 --- a/Go-1.10-Release-Party.md +++ b/Go-1.10-Release-Party.md @@ -1,101 +1,4 @@ -### What's happening? -To celebrate the release of Go 1.10 we're to organising a world wide release party during the month of February 2018 🎉 +The Go wiki on GitHub has moved to go.dev (#61940). -#### So what is the release date? -Go 1.10 was released on February 16. +Try or . -### Sounds awesome, how can you get involved? -- If you host a Go user group or meetup, schedule a meetup during February, and celebrate with Gophers around the world. -- If you're a member of a Go user group or meetup, pester your organiser and let them know you'd like to participate. - -After the event post a photo, make a video, write a blog post, scribble on your Facebook wall, or tweet something pithy. Let's see how big we can make the celebration. - -Spread the word using hashtag [#GoReleaseParty](https://twitter.com/hashtag/goreleaseparty) - -Don't forget to add your meetup's details :point_down: right here. - -#### Who's involved? -Here is a list of the groups who are participating. -- Madrid, Spain: Feb 8 7:30 pm at [source{d}](https://sourced.tech). [View the event](https://www.meetup.com/go-mad/events/247296417/) -- Copenhagen, Denmark: Feb 15 7:00 pm at Maersk. [View the meetup](https://www.meetup.com/Go-Cph/events/242615767/) -- Minsk, Belarus: Feb 15 7:00 pm at SPACE. [View the event](https://www.facebook.com/events/202545833823265/) -- London, UK: Feb 15 6:30 pm at Shazam. [View the meetup](https://www.meetup.com/Go-London-User-Group/events/247343552/) -- Paris, France: Feb 15 7:15 pm at Mobiskill. [View the meetup](https://www.meetup.com/Golang-Paris/events/247526552) -- Orlando, FL, United States: Feb 19 7:00 PM at Familab. [View the meetup](https://www.meetup.com/OrlanGo/) -- Shizuoka, Japan: Feb 20 6:30 pm at Ageya Take. [View the event](https://shizuoka-go.connpass.com/event/79570/) -- Jakarta, Indonesia: Feb 20 7:00pm at Hacktiv8. [View the event](https://www.meetup.com/GoJakarta/events/247559760/) -- Tokyo, Japan: Feb 20 7:00 pm at Google Tokyo. [View the event](https://gocon.connpass.com/event/78128/) -- Okayama, Japan: Feb 20 7:00 pm at Kurashiki Coffee Okayama Aoe. [View the event](https://connpass.com/event/79528/) -- Reston, VA, USA: Feb 21 6:45 pm at Comcast. [View the meetup](https://www.meetup.com/Golang-Reston/events/246828702/) -- San Francisco, CA: Feb 21 6:00 pm at Cloudflare [View the event](https://www.meetup.com/golangsf/events/245472050/) -- Phoenix, AZ, United States: Feb 22 6:30 PM at Galvanize. [View the meetup](https://www.meetup.com/Golang-Phoenix/events/247751393/) -- Warsaw, Poland: Feb 22 7:00 pm at Kawiarnia Crux [View the meetup](https://www.meetup.com/pl-PL/Golang-Warsaw/events/247732050/) -- Santiago, Chile: Feb 22 7:00 pm at Mercado Libre Chile. [View the meetup](https://www.meetup.com/golang-chile/events/247511315/) -- Aachen, Germany: Feb 22 7:00pm at hosting.de. [View the meetup](https://www.meetup.com/Gophers-Aachen/events/247739398/) -- Waterloo, Canada: Feb 22 7:00pm at the Lion Brewery in the Heuther Hotel. [View the meetup](https://www.meetup.com/Golang-KW/events/247770215/) -- Lodz, Poland: Feb 22 6:00 pm at Co/Walk HUB [View the meetup](https://www.meetup.com/Golang-Lodz/events/247802682/) -- İzmir, Turkey: Feb 23 7:30 pm at Drunken Duck [View the event](https://www.facebook.com/events/144640862880347/) -- Milan, Italy: Feb 23 8:00 pm at Venini42 [View the event](https://www.meetup.com/it-IT/Golang-Milano/events/247741405/) -- Bengaluru, India: Feb 24 10:00 am at OpenEBS Office Space. [View the meetup](https://www.meetup.com/Golang-Bangalore/events/247344493/) -- Moscow, Russia: Feb 24 11:30 am at Badoo. [View the meetup](https://golang-moscow.timepad.ru/event/663880/) -- Yoshkar-Ola, Russia: Feb 24 2:00 pm at iSpring. [View the meetup](https://golang-yoshar-ola.timepad.ru/event/667643/) -- Zagreb, Croatia: Feb 26 6:00 pm at MaMa. [View the meetup](https://www.meetup.com/Golang-ZG/events/247644001/) -- Edmonton, Canada: Feb 26 6:30 pm at Startup Edmonton [View the meetup](https://www.meetup.com/startupedmonton/events/247825453/) -- Berlin, Germany: Feb 26 7:00 pm at n26. [View the meetup](https://www.meetup.com/golang-users-berlin/events/247289781/) -- Stockholm, Sweden: Feb 27 17:30 at Betalo. [View the meetup](https://www.meetup.com/Go-Stockholm/events/247955211/) -- Baltimore, MD: Feb 27 06:30pm at ZeroFOX. [View the meetup](https://www.meetup.com/BaltimoreGolang/events/247958575/) -- Joinville, Brazil: Feb 27 7:00 pm at ContaAzul. [View the meetup](https://www.meetup.com/Joinville-Go-Meetup/events/247548485/) -- Brisbane, Australia: Feb 28 6:00 pm at Jumbo Interactive. [View the meetup](https://www.meetup.com/Brisbane-Golang-Meetup/events/247337741/) -- Frankfurt, Germany: Feb 28 6:30 pm at SANID GmbH, [View the meetup](https://www.meetup.com/gophers-frm/events/247776234/) -- Chicago, IL: Feb 28 6:00pm at Enova. [View the meetup](https://www.meetup.com/Women-Who-Go-Chicago/events/247802512/) & [View the meetup](https://www.meetup.com/Chicago-Gophers/events/247805023/) -- Fort Lauderdale, FL: Mar 1 6:30 pm at Microsoft, [View the meetup](https://www.meetup.com/Go-Miami/events/247987413/) -- Zurich, Switzerland: Mar 1 7:00 pm at Job Cloud. [View the meetup](https://www.meetup.com/Zurich-Gophers/events/246188927/) -- Florianópolis, Brazil: Mar 17 3:00 pm at Involves. [View the meetup](https://www.meetup.com/pt-BR/Floripa-Gophers/events/kzmchpyxfbwb/) -- Portland, Oregon: April 24th 6:00 pm at New Relic. [View the meetup](https://www.meetup.com/PDX-Go/events/248938586/) - -_If your group is not listed here yet, edit the page and add yourself in a chronological order._ -_Organisers, once you've added your group, consider tweeting out a link to the page to raise awareness._ - -### Stay in touch - -Trying to co-ordinate dozens of meetup groups around the globe will be challenging. Here are some ways you can plan your event, and keep up to date. - -As always, if you get stuck, or need help, please [contact the organisers directly](https://github.com/golang/go/wiki/Go-1.10-release-party#no-seriously-whos-organising-this), we're here to help. -. -##### Slack Channel -We have a channel for the [release party](https://gophers.slack.com/messages/go-release-party/) on the [Gophers Slack](https://gophers.slack.com/messages/go-release-party/). If you need an invite to Slack, [you can request an automatic invite with this link](https://invite.slack.golangbridge.org/). - -##### Mailing list -We have set up a [mailing list for meetup organisers](https://groups.google.com/forum/#!forum/go-meetup-organisers) to ask questions. - -### What happens in a release party? -As with the previous [Go 1.6](https://github.com/golang/go/wiki/Go-1.6-release-party) and [Go 1.8](https://github.com/golang/go/wiki/Go-1.8-release-party) release parties, this is a great opportunity to spread the word about the improvements landing 1.10, and the plans for what is coming next! - -#### Resources - -You can use the slide deck that the Go London User Group in London will use. It's [available here](https://talks.godoc.org/github.com/dlsniper/talks/2018/go-1.10-release-party/presentation.slide#1) ([source](https://github.com/dlsniper/talks/tree/master/2018/go-1.10-release-party)) - -_Please send PR's with corrections/additions_ - -[Here's a link to the _draft_ Go 1.10 release notes](https://tip.golang.org/doc/go1.10). - -[Here's a link](https://speakerdeck.com/campoy/the-state-of-go-1-dot-10) to the talk by Francesc Campoy: The State of Go (February 2018). - - -### What'll happen if Go 1.10 isn't out during February? -If all else fails... at least we'll have each other. - - -### Who's organising this? -Well, if you run a Go meetup, you are. It can't be a worldwide release party without meetups around the globe. - -#### No, seriously, who's organising this? -Here are the organisers so far: -- [Natalie Pistunovich](mailto://natalie.pistunovich@gmail.com) - [@NataliePis](https://twitter.com/nataliepis) -- [Dave Cheney](mailto://dave@cheney.net) - [@davecheney](https://twitter.com/davecheney) -- [João Henrique Machado Silva](mailto://joaoh82@gmail.com) - [@joaoh82](https://twitter.com/joaoh82) -- [Florin Pățan](mailto://florinpatan@gmail.com) - [@dlsniper](https://twitter.com/dlsniper) - -_Want to help? Edit this page and add yourself_ - -If you have questions, please reach out to one of the organisers. \ No newline at end of file diff --git a/Go-1.6-release-party.md b/Go-1.6-release-party.md index f983d454..0323f58d 100644 --- a/Go-1.6-release-party.md +++ b/Go-1.6-release-party.md @@ -1,170 +1,4 @@ -### Party recap on tweets +The Go wiki on GitHub has moved to go.dev (#61940). -Missed or missing the party? Here is a flashback for you: https://storify.com/gobridge/go-16v-world-release-party +Try or . ----- -### What's happening? -To celebrate the release of Go 1.6 we're organising a world wide release party on February the 17th, 2016. - -#### Hang on, did you say Go 1.6 ships on the 17th of February? -Nope! Go 1.6 ships when it's ready. With that said, things are looking pretty good for a mid Feb release. Using the power of software estimation, a date was plucked from the aether that happened to coincide with several meetups that were already in the works. - -### Sounds awesome, how can you get involved? -- If you host a Go user group or meetup, schedule a meetup on the 17th of Feb and celebrate with Gophers around the world. -- If you're a member of a Go user group or meetup, pester your organiser and let them know you'd like to participate. - -After the event post a photo, make a video, write a blog post, scribble on your Facebook wall, or tweet something pithy. Let's see how big we can make the celebration. - -Don't forget to add your details :point_down: right here. - -#### Who's involved? -Here is a list of the groups who are participating. -- [Sydney Go users' group](http://www.meetup.com/golang-syd/events/228276309/) -- [Go-Miami](http://www.meetup.com/Go-Miami/events/228280324/) -- [San Diego Gophers](http://www.meetup.com/sdgophers/events/228129827/) -- [PDX Go](http://www.meetup.com/PDX-Go/events/228220792/) -- [GopherConIndia](http://www.gophercon.in/) -- [Belarus Golang User Group](https://events.dev.by/belarus-golang-user-group-meetup-2) -- [Ukrainian Golang User Groups](http://www.meetup.com/uagolang/events/228343484/) -- [Lviv Golang Group](http://www.meetup.com/Lviv-Golang-Group/events/228344940/) -- [Edmonton Go](https://edmontongo.org/) (Feb 22) -- [Software Craftsmanship Toulouse](http://www.meetup.com/fr-FR/Software-Craftsmanship-Toulouse/events/228285655/) -- [Golang Paris](http://www.meetup.com/fr-FR/Golang-Paris/events/228563347/) -- [Polish GLUG Meetup](http://www.meetup.com/GoLang-User-Group-Wroclaw/events/228369658/) -- [Google Developer Group Gigcity](http://www.meetup.com/GDG-Gigcity/events/228373161/) -- [Golang Montréal](https://golangmontreal.org) (Feb 22nd) -- [Golang Vietnam](https://www.facebook.com/events/1651152271814093/) (Feb 23) -- [Gophers Katowice](http://www.meetup.com/Gophers-Katowice/events/228375778/) -- [GoSF](http://www.meetup.com/golangsf/events/226090306/) -- [Boston Golang](http://www.meetup.com/Boston-Go-lang-User-Group/events/228398963/) -- [Go-Tampa](http://www.meetup.com/Go-Tampa/events/227365472/) -- [Atlanta](http://www.meetup.com/Go-Users-Group-Atlanta/events/228336134/) -- [GoAKL](http://www.meetup.com/Go-AKL/events/228436705/) -- [Golang Barcelona](http://www.meetup.com/es-ES/Golang-Barcelona/events/228438675/) -- [Golang Singapore](http://www.meetup.com/golangsg/events/228148961/) (February 18) -- [Go Maryland](http://www.meetup.com/Go-Maryland/events/228445301/) (February 18) -- [Orange County Gophers](http://www.meetup.com/Orange-County-Gophers/events/228458630/) -- [Central Jersey Tech Meetup](http://www.meetup.com/Central-Jersey-Tech-Meetup/events/228461491/) -- [Kansas City Golang Meetup](http://www.meetup.com/Kansas-City-Go-lang-Meetup/events/228467750/) -- [Mexico City Gophers](http://www.meetup.com/GophersMX/events/228478343/) -- [Women Who Go London](http://www.meetup.com/Women-Who-Go-London/events/228254901/) -- [Go Israel](http://www.meetup.com/Go-Israel/events/228520409/) -- [Go User Group Hamburg](http://www.meetup.com/Go-User-Group-Hamburg/events/228370048/) -- [Golang Brasil - São Paulo](http://www.meetup.com/golangbr/events/228525183/) (Saturday, February 20) -- [Zürich Gophers - Switzerland](http://www.meetup.com/Zurich-Gophers/events/228578365/) -- [Golang Reston](http://www.meetup.com/Golang-Reston/events/228252844/) -- [GoMAD](http://www.meetup.com/go-mad/events/228591957/) -- [GoCon](http://gocon.connpass.com/event/26572/) -- [GDG Golang Berlin](http://www.meetup.com/golang-users-berlin/events/228632499/) (Feb 17) -- [ATX Golang](http://www.meetup.com/atxgolang/events/226396146/) (Austin) -- [GoCon Tokyo](http://gocon.connpass.com/event/26572/) -- [Golang Italian Hackers, at Develer](https://www.eventbrite.it/e/biglietti-go-16-release-party-21450150979) -- [Go London User Group](http://www.meetup.com/Go-London-User-Group/events/228371135/) -- [Seattle Go Programmers](http://www.meetup.com/golang/events/228465356/) -- [Vilnius Golang](http://www.meetup.com/Vilnius-Golang/events/228751719/) -- [Go DC](http://www.meetup.com/Golang-DC/events/228378173/) -- [GDG Korea Golang](https://plus.google.com/u/0/events/cku5socs07a6o3oihqu3dfvhf70) (Feb 22) -- [Golang ZG, Zagreb Croatia] (http://www.meetup.com/Golang-ZG/events/228863217/) -- [Gophers-ir Iran/Tehran] (https://evand.ir/events/gophers-16) (February 18) -- [Golang Brazil - Porto Alegre](https://www.facebook.com/events/980566935370382/) (February 17) -- [Seattle Go Programmers] (http://www.meetup.com/golang/events/228465356/) (Wed February 17) -- [Go Cape Town] (http://www.meetup.com/gocapetown/events/228874257/) -- [Golang Hong Kong] (http://www.meetup.com/GolangHK/events/228551636/) -- [Golang Lima] (http://www.meetup.com/es-ES/Golang-Peru/events/228643682/) -- [Gophers Barranquilla] (http://www.meetup.com/es-ES/Gophers-Barranquilla/events/228899893/) - -_If your group is not listed here yet, edit the page and add yourself._ -_Organisers, once you've added your group, consider tweeting out a link to the page to raise awareness._ - -### Stay in touch - -Trying to co-ordinate dozens of meetup groups around the globe will be challenging. Here are some ways you can plan your event, discuss it online, and keep up to date. - -As always, if you get stuck, or need help, please [contact the organisers directly](https://github.com/golang/go/wiki/Go-1.6-release-party#no-seriously-whos-organising-this), we're here to help. - -##### Slack Channel -We have a channel for the [release party](https://gophers.slack.com/messages/go-release-party/) on the [Gophers Slack](https://gophers.slack.com/messages/go-release-party/). If you need an invite to Slack, [you can request an automatic invite with this link](https://gophersinvite.herokuapp.com/). - -##### Mailing list -We have set up a [google groups mailing list](https://groups.google.com/forum/#!forum/go-meetup-organisers) for meetup organisers to ask questions. At the moment the list is focused on the event on the 17th, hopefully if that goes well the mailing list will become a useful resource in the future. - -### What happens in a release party? -Go 1.6 is the 7th release of the language which has been open source since November 10th, 2009 -- that's 6.5 years since the project was open sourced and nearly 4 years since the 1.0 release. -A lot has changed in the language since 1.0, so this is a great opportunity to discuss the improvements landing 1.6. - -#### Resources - -Francesc Campoy presented his _State of Go_ talk at FOSDEM, which includes details of the upcoming Go 1.6 release. [His slide are available online](https://talks.golang.org/2016/state-of-go.slide#1). - -Here a Go 1.6 presentation slide deck from the Go Sydney users' group. Feel free to use this for your meetup. - -[talks.godoc.org/github.com/davecheney/gosyd/go1.6.slide](http://talks.godoc.org/github.com/davecheney/gosyd/go1.6.slide) - -_Source_: https://github.com/davecheney/gosyd/blob/master/go1.6.slide - -_Please send PR's with corrections/additions_ - -#### Go 1.6 new and noteworthy - -_Please help by expanding this section so meetup organisers can share these details with their groups._ - -- [Go 1.6 release notes (draft)](http://tip.golang.org/doc/go1.6) -- HTTP/2. - - Go 1.6's `net/http` package supports [HTTP/2](https://http2.golang.org/) for both the client and server out of the box. - [Here is a video of @bradfitz giving an overview of Go 1.6's HTTP/2 support](https://www.youtube.com/watch?v=gukAZO1fqZQ). -- Garbage Collector improvements. - - Go 1.6 focused heavily on improvements to the low latency collector shipped in Go 1.5. - Rick Hudson gave a [presentation at GopherCon 2015](https://www.youtube.com/watch?v=aiv1JOfMjm0) describing the low latency collector delivered in Go 1.5, and gave hints to the improvements being worked on for 1.6. - Rick recently [recorded an interview with InfoQ](http://www.infoq.com/interviews/hudson-go-gc) which focused on 1.6 in more detail. -- GOVENDOREXPERIMENT becomes the default. - - Go 1.5 added experimental support for a mechanism of including the source of your package's dependencies in the package itself, colloquially known as _vendoring_. This feature was opt-in during Go 1.5. - Go 1.6 makes the vendor support the default, and it's likely that packages will start to use it soon. - -- `text/template` changes. - A long requested ability to [trim whitespace in templates](http://tip.golang.org/pkg/text/template/#hdr-Text_and_spaces) has arrived. This template - - `"{{23 -}} < {{- 45}}"` - - will produce this output - - `"23<45"` - -- cgo changes - - cgo continues to get stricter about sharing data between Go and C. http://tip.golang.org/cmd/cgo/#hdr-Passing_pointers - - Ian Lance Taylor has put a lot of work into making signal handling more sane. - -- More supported platforms. - Go 1.6 adds experimental ports to Linux on 64-bit MIPS (linux/mips64 and linux/mips64le). Note that this is 64 bit MIPS, not the older 32 bit MIPS commonly found in routers. - - 64-bit PowerPC (linux/ppc64le), Go 1.6 now supports cgo with external linking and is roughly feature complete. - - Go 1.6 also adds an experimental port to Android on 32-bit x86 (android/386). - -_Did you contribute to Go 1.6 and your contribution is not listed here? Edit this page and add some details about what you did._ - -### What'll happen if Go 1.6 comes out early? -It'll ruin the surprise, but only a little. Being realistic, even without the difficulty of timezones it's impossible to run every meetup at exactly the same time. As mentioned above, Feb 17 is an arbitrary date. - -If you're a meetup organiser, Feb 17th would be great, but your participation is more important than being able to organise your group for exactly the 17th. - -### What'll happen if Go 1.6 isn't out by the 17th? -Well ... at least we'll have each other. - -The feature set of Go 1.6 isn't going to change in the next few weeks. If Go 1.6 ships after the 17th, it will be a little anticlimactic that we jumped the gun, but it's not a big deal. - -### Who's organising this? -Well, if you run a Go meetup, you are. It can't be a worldwide release party without meetups around the globe. - -#### No, seriously, who's organising this? -Here are the organisers so far: -- [Dave Cheney](mailto://dave@cheney.net) - @davecheney -- [Carlisia Campos](mailto://carlisia@golangbridge.org) - @carlisia - -_Want to help? Edit this page and add yourself_ - -If you have questions, please reach out to one of the organisers. \ No newline at end of file diff --git a/Go-1.8-Release-Party.md b/Go-1.8-Release-Party.md index 05b1830a..8794aa59 100644 --- a/Go-1.8-Release-Party.md +++ b/Go-1.8-Release-Party.md @@ -1,147 +1,4 @@ -### What's happening? -To celebrate the release of Go 1.8 we're to organising a world wide release party on February the 16th, 2017. +The Go wiki on GitHub has moved to go.dev (#61940). -#### Hang on, did you say Go 1.8 ships on the 16th of February? -Nope! Go 1.8 is in good shape to ship in early February, but no firm release date has been published; it might be as early as the 1st of Feb, or it might not. +Try or . -### Sounds awesome, how can you get involved? -- If you host a Go user group or meetup, schedule a meetup on the 16th of Feb, or as close to it as convenient, and celebrate with Gophers around the world. -- If you're a member of a Go user group or meetup, pester your organiser and let them know you'd like to participate. - -After the event post a photo, make a video, write a blog post, scribble on your Facebook wall, or tweet something pithy. Let's see how big we can make the celebration. - -Spread the word using hashtag [#GoReleaseParty](https://twitter.com/hashtag/goreleaseparty) - -Don't forget to add your meetup's details :point_down: right here. - -#### Who's involved? -Here is a list of the groups who are participating. -- Buenos Aires, Argentina: Feb 16 7:00 pm. Location: Mercado Libre's Headquarters. (https://www.meetup.com/es-ES/Golang-Argentina/) -- Orlando, FL: Feb 16 7:00PM, Location TBD, [Orlando Gophers](https://www.meetup.com/OrlandoGophers/) -- Mexico City, Mexico: Feb 16 7:00pm at Palo-IT, view the [meetup](https://www.meetup.com/GophersMX/events/237559318/) for details. -- Helsinki, Finland: Feb 16 5:30pm, [view the meetup](https://www.meetup.com/Helsinki-Gophers/events/237504573/) -- Tehran, Iran: Feb 16 5pm , at [Clickyab] (https://clickyab.com) office. Visit [event page](https://goo.gl/XgQ02E) for more info or contact [@fzerorubigd](https://twitter.com/fzerorubigd). -- Florence area, Italy: Feb 16 6pm CET, at Develer SRL. Visit [event page](https://www.eventbrite.it/e/biglietti-go-18-release-party-31564433069?utm-medium=discovery&utm-campaign=social&utm-content=attendeeshare&aff=escb&utm-source=cp&utm-term=listing) for more detail or contact [@golab_conf](https://twitter.com/golab_conf). -- Aachen, Germany: Feb 16 7pm, [view the meetup](https://www.meetup.com/Gophers-Aachen/events/237423932/) -- Bengaluru, India - Feb 16th 7.00pm at [Gojek] (https://twitter.com/GojekTech) office. Contact [@rbharshetty] (https://twitter.com/rBharshetty) or view the [meetup] (https://www.meetup.com/Golang-Bangalore/events/237156123/) for details -- Munich, Germany: Feb 15 7pm at Stylight. Contact [@lc0d3r](https://twitter.com/lc0d3r), [@munich_gophers](https://twitter.com/munich_gophers) or view the [meetup](https://www.meetup.com/Munich-Gophers-Go-User-Group/events/236962991/) for details. -- Washington DC: Feb 16 7pm at MakeOffices Dupont. View the [Golang meetup](https://www.meetup.com/Golang-DC/events/236696696/) and [GDG-DC] (https://www.meetup.com/gdg-dc) [Meetup] (https://www.meetup.com/gdg-dc/events/237677174/) for details. -- Columbia, MD: Feb 16 5:30pm at Tier 1 Consulting Group. See [event page](https://www.meetup.com/Go-Maryland/events/237121509/) -- Halifax, Nova Scotia, Canada **Postponed due to weather, will be rescheduled** Contact [@danp](https://twitter.com/danp128) for more info. -- Belo Horizonte, MG, Brazil: Feb 16 7pm at The Plant. Contact [@joaoh82](https://twitter.com/joaoh82) for more info or go to [Go Belo Horizonte](https://www.meetup.com/go-belo-horizonte/) -- Florianólis, SC, Brazil: Feb 16 7pm at Neoway Business Solutions. Contact [@ricardolonga](https://twitter.com/ricardolonga) for more info or go to [Floripa Gophers](https://www.meetup.com/Floripa-Gophers/events/236729070/) -- São Paulo, Brazil: Feb 16 7pm at TBD. Contact [@vdemario](https://twitter.com/vdemario) for more info or check the [meetup page](https://www.meetup.com/golangbr/) -- [@GolangParis](https://twitter.com/golangparis), France, Feb 16 7pm at [Deezer](www.deezer.com/features), see [meetup page](https://www.meetup.com/fr-FR/Golang-Paris/events/236696058). Ping: gaufres [at] golangparis.org. -- Sydney, Australia: Feb 16 6pm at TBD. Contact [@chewxy](https://twitter.com/chewxy) for more info. The [event page](https://www.meetup.com/golang-syd/events/236680493/) -- Moscow, Russia: Feb 16 7pm. [Meetup group](https://www.meetup.com/Golang-Moscow/events/237132934/). -- Novosibirsk, Russia: Feb 19 11am NOVT. Contact [@lkalneus](https://twitter.com/lkalneus) for more info. [Live stream](https://www.youtube.com/watch?v=r1KBpBpEinA) -- [@DenverGophers](https://twitter.com/DenverGophers) Feb 16 6:00pm at Comcast Viper. View the [meetup](http://bit.ly/denver-1-8-release-party) or contact [@apriendeau](https://twitter.com/apriendeau) for more info. -- [@MinneapolisGo](https://twitter.com/MinneapolisGo) Feb 16 6:00pm at Agosto. View the [meetup](https://www.meetup.com/Minneapolis-Ultimate-Golang/events/236698705/) or contact [@corylanou](https://twitter.com/corylanou) for more info. -- Amsterdam, the Netherlands: Feb 16 6pm at [Wercker](http://www.wercker.com). View the [meetup](https://www.meetup.com/golang-amsterdam/events/236723017/) for more details and RSVP. -- Wroclaw, Poland: Feb 16 7pm at Kuznicza 10. View the [meetup](https://www.meetup.com/GoLang-User-Group-Wroclaw/events/236727341/) or contact [@viru](https://github.com/viru/) for more details. -- Stockholm, Sweden: Feb 21 6pm at TV4. View the [meetup](https://www.meetup.com/Go-Stockholm/events/236748141/) or contact [@marcusolsson](https://twitter.com/marcusolsson/) for more details. -- New York, NY: Feb 16 at 6:30PM at Stack Overflow. RSVP for [meetup](https://www.meetup.com/golanguagenewyork/events/236871667/) Contact [@wikiwalk](https://twitter.com/wikiwalk) for more details. -- Madrid, Spain: Feb 16 at 7:30PM at source{d}, The event will be announced on [meetup](https://www.meetup.com/go-mad/). Contact [@mcuadros_](https://twitter.com/mcuadros_) for more details. -- Murcia, Spain: Feb 16 at 7:00PM at CEEIM. Will announce the event on [meetup](https://www.meetup.com/Gophers-Murcia/). Contact [@ANPez](https://twitter.com/ANPez) for more details. -- Taipei, Taiwan: Feb 16 at 7:30PM at [Dcard](https://www.dcard.tw). RSVP on the [kktix page](http://golang.kktix.cc/events/gtg21). Contact [@kkdai](https://twitter.com/Evan_Lin) for more details. -- Budapest, Hungary: Feb 16 at 7:00PM at [Prezi House of Ideas](https://www.google.com/maps?f=q&hl=en&q=1065+Hajós+street+35.,+Budapest,+hu). RSVP on the [meetup page](https://www.meetup.com/go-budapest/events/236811843/). For details please contact the organizer: [@gulyasm](https://twitter.com/gulyasm) -- Reston, VA: Feb 16 at 6:45PM at Comcast. See more details and RSVP on the [meetup page](https://www.meetup.com/Golang-Reston/events/236807731/). -- Lille, France: Feb 16 at 6:45PM at [Epitech Lille](https://goo.gl/maps/C6H7CjZWrFv). [Meetup page](https://www.meetup.com/GDG-Lille/events/236825262). -- Hamburg, Germany: Feb 16 at 7PM place at [loodse](https://loodse.com/en/). [Meetup page](https://www.meetup.com/Go-User-Group-Hamburg/events/236813440/). -- Okayama, Japan: Feb 16 7pm at Kurashiki Coffee Shop. See an [event page](https://connpass.com/event/48433/) or contact [@qt_luigi](https://twitter.com/qt_luigi) for more info. -- Phoenix, AZ: Feb 16 at 6:30PM, at [Brightcove](https://www.brightcove.com), Scottsdale. See [event page](https://www.meetup.com/Golang-Phoenix/events/236891853/) or contact [@golangPhoenix](https://twitter.com/golangPhoenix) -- Toronto, Canada: Firkin on King, See [event page](https://www.meetup.com/go-toronto/events/236855730/) -- Seattle, WA: Feb 16 at 6PM at Uber, See [event page](https://www.meetup.com/golang/events/236803478/) -- Vancouver, BC, Canada: Feb 16 at 6PM at [Hootsuite](http://hootsuite.com), See [event page](https://www.meetup.com/golangvan/events/236807698/) -- San Francisco, CA: Feb 16 at 6:30PM, venue TBD. See [event page](https://www.meetup.com/golangsf/events/236673793/) -- Copenhagen, Denmark: Feb 16th at 6PM, at Vivino. See [event page](https://www.meetup.com/Go-Cph/events/233646078/) or contact [@phr0e](https://twitter.com/phr0e) or [@CphGophers](https://twitter.com/CphGophers) -- Leeds, England, UK: Feb 16th at 6PM, at White Cloth Gallery in Leeds (LS1 4HT). See [event page](https://www.eventbrite.co.uk/e/go-18-release-party-tickets-31217190457) -- Zurich, CH, Feb 23rd at 6:30PM at Unic AG offices in Altstetten. See [event page](https://www.meetup.com/Zurich-Gophers/events/236745236/) -- Framingham, Ma - Feb 16th 7pm - See [event page](https://www.meetup.com/Framingham-Golang-Meetup/events/236999473/) -- Cambridge, Ma - Feb 16th 6:30pm, at the Google Office in Cambridge - See [event page](https://www.meetup.com/Boston-Go-lang-User-Group/events/237190202/), contact [@bostongolang](https://twitter.com/bostongolang) -- Tokyo, Japan - Feb 16th 7pm - See https://gocon.connpass.com/event/48281/ -- San Diego, CA @ ScouRED - Feb 16th 6pm - See [event page](https://www.meetup.com/sdgophers/events/236202461/), contact [@carlisia](https://twitter.com/carlisia) -- Philadelphia, PA - Feb 16th 6PM, at Sidecar. See [Meetup page](https://www.meetup.com/GoLangPhilly/events/236965685/) or contact [@golangphilly](https://twitter.com/golangphilly) -- Milan, Italy - Feb 16th 6.30pm, at Ibuildings' offices. For info tweet to [@kmox83](https://twitter.com/kmox83) or [@mavimo](https://twitter.com/mavimo) - See the [event page](https://www.meetup.com/Golang-Milano/) -- Singapore - Feb 16th 7.30pm, at Singapore Power office. See the [Meetup page](https://www.meetup.com/golangsg/events/236725569/) or tweet to [@golangSG](https://twitter.com/golangSG) -- Cardiff (Wales UK) - Feb 15th 18:00 at Tramshed Cardiff. See the [Meetup page](https://www.meetup.com/Cardiff-Go-Meetup/events/237158460/) or tweet to [@cdfgolang](https://twitter.com/cdfgolang) -- Minsk, Belarus - Feb 16th 7.00pm at Juno. [Meetup Page ->] (https://www.meetup.com/JunoCrew-meetups/events/237671824/) [Registration here ->](https://goo.gl/forms/Fw07rIouWDyMiT5e2) -- Bangor (Wales UK) - Feb 16th 7:00 PM hosted by [NorthWalesTech](http://northwales.technology/). See the [Meetup page](https://www.meetup.com/NorthWalesTech/events/236961582/) or tweet to [@northwalestech](https://twitter.com/northwalestech) -- Odessa, Ukraine - Feb 25th 10:00am at VertaMedia. See the [meetup page](http://vmes.vertamedia.com/). -- Valencia, Spain - Feb 18th 17:00pm at Oh my Game Bar. Visit the [Telegram group](https://telegram.me/golangvalencia) or visit our [twitter](https://twitter.com/golangvalencia). -- Austin, TX (USA) - Feb 16th 6:30 PM (GMT-6) visit the [Austin Go Language User Group](https://www.meetup.com/atxgolang/events/237329768/) Meetup page for details -- Hyderabad, India - Feb 16th 6:30 PM visit the [Hyderabad Gophers](https://www.meetup.com/Hyderabad-Gophers/events/237360939/) Meetup page for details or contact [@itsbalamurali](https://twitter.com/itsbalamurali), [@gouthamve](https://twitter.com/putadent) for more details. -- Edmonton, AB (Canada) - Feb 27th 6:30 PM visit [Edmonton Go](https://edmontongo.org/) and RSVP via the [meetup page](https://www.meetup.com/startupedmonton/events/jptkwlywdbkc/). -- Dallas, TX - Feb 16th 7:00 PM visit [GoDFW](https://www.meetup.com/GolangDFW/) and RSVP via the [meetup page](https://www.meetup.com/GolangDFW/events/237369419/) -- Trójmiasto (Gdańsk-Sopot-Gdynia), Poland - Feb 13th 6:00 PM visit [GUGT](https://www.meetup.com/Golang-User-Group-Trojmiasto/) and RSVP via the [meetup page](https://www.meetup.com/Golang-User-Group-Trojmiasto/events/237271455/) -- Istanbul, Turkey - Feb 16th 7:00 PM at [Insider](http://useinsider.com/?utm_source=Github&utm_campaign=Go%201.8%20Release%20Party). RSVP via the [eventbrite page](https://www.eventbrite.com/e/insider-go-18-release-party-tickets-31826925190). -- Strasbourg, France - Feb 16th 6:30 PM at [La Plage Digitale](http://www.alsacedigitale.org/). RSVP via the [meetup page](https://goo.gl/R1A8Mg). -- Waterloo, Canada - Feb 16 7:00 PM at the Lion's Brewery at the [Heuther Hotel](http://www.huetherhotel.com/). RSVP via the [meetup page](https://www.meetup.com/Golang-KW/events/237554495/). -- Republic of Korea - Feb 16 8:00 Pm at GangNam 2nd TOZ. See the [meetup page] -(https://www.facebook.com/groups/golangko/). -- Dublin, Ireland - Feb 16 6:30 PM at Arista Networks. [Meetup](https://www.meetup.com/Dublin-Go-Meetup/events/237589126/) details. -- Berlin, Germany - Feb 28 7:00 PM at Amazon. RSVP at [Meetup](https://www.meetup.com/golang-users-berlin/events/237611330/). -- Portland, OR (pdxgo) - Feb 16 6:30 PM at Esri R&D Center. RSVP at [Meetup](https://www.meetup.com/PDX-Go/events/236702058/). -- Lyon, France - Fev 16 7 PM at OVH. RSVP at [Meetup](https://www.meetup.com/Golang-Lyon/events/237073142/) -- New York - Fev 16 7:00 PM at [Nulab](http://nulab-inc.com/). RSVP at [Meetup](https://www.meetup.com/Bowery-Go/events/237620656/) -- Dresden, Germany - Feb 16th 6:30PM at [LOVOO](https://www.lovoo.com). RVSP at http://doodle.com/poll/s2bw6eu4ywhqg9ut -- London, UK - Feb 15th 6:30PM at Skills Matter Code Node RSVP at [Meetup](https://www.meetup.com/Go-London-User-Group/events/236963108/) -- Auckland, NZ - Feb 15th 6:00PM at Vend, RSVP at [Meetup](https://www.meetup.com/Go-AKL/events/237547913/) -- 🇻🇳 Saigon, Vietnam - Feb 21 7:00 PM, RSVP at our [Facebook Event page](https://www.facebook.com/events/386900578337910/) -- Brno, CZ - Feb 28th 7:00PM. RSVP via the [meetup event page](https://www.meetup.com/Golang-Brno/events/237697083/). -- Atlanta, GA (USA) - Feb 16th at 6:30PM EST. RSVP at the [Meetup Page](https://www.meetup.com/Go-Users-Group-Atlanta/events/237150679/) or contact [@rlmcpherson](https://twitter.com/rlmcpherson) -- Edinburgh, Scotland - Feb 16th 6:30 PM GMT. RSVP at [Meetup](https://www.meetup.com/Edinburgh-Golang-meetup/events/237706628/) or contact [@macqueenism](https://twitter.com/macqueenism) or [@hackebrot](https://twitter.com/hackebrot). -- Boise, ID (USA) - Feb 16th 6:00PM (MST). RSVP via the [meetup event page](https://www.meetup.com/Boise-Go-lang-Meetup/events/237412184/). -- Cape Town, South Africa - Feb 16th 6:30PM (SAST). RSVP via the [meetup event page](https://www.meetup.com/gocapetown/events/237398240/) or get in touch with [@clvnb](https://twitter.com/clvnb) -- Lviv, Ukraine - Feb 24th 6:30PM (EET). RSVP via the [meetup event page](https://www.meetup.com/Lviv-Golang-Group/events/237729679/) -- Brest, France - Feb 21th 6:30PM. See the [Meetup page](https://www.meetup.com/fr-FR/FinistJUG/events/237468708/) - -_If your group is not listed here yet, edit the page and add yourself._ -_Organisers, once you've added your group, consider tweeting out a link to the page to raise awareness._ - -### Stay in touch - -Trying to co-ordinate dozens of meetup groups around the globe will be challenging. Here are some ways you can plan your event, and keep up to date. - -As always, if you get stuck, or need help, please [contact the organisers directly](https://github.com/golang/go/wiki/Go-1.8-release-party#no-seriously-whos-organising-this), we're here to help. -. -##### Slack Channel -We have a channel for the [release party](https://gophers.slack.com/messages/go-release-party/) on the [Gophers Slack](https://gophers.slack.com/messages/go-release-party/). If you need an invite to Slack, [you can request an automatic invite with this link](https://invite.slack.golangbridge.org/). - -##### Mailing list -We have set up a [mailing list for meetup organisers](https://groups.google.com/forum/#!forum/go-meetup-organisers) to ask questions. - -### What happens in a release party? -As with the previous [Go 1.6](https://github.com/golang/go/wiki/Go-1.6-release-party) and Go 1.7 release parties, this is a great opportunity to spread the word about the improvements landing 1.8, and the plans for the 1.9 development cycle. - -#### Resources - -A sample slide deck that you can use is [available here](https://talks.godoc.org/github.com/davecheney/go-1.8-release-party/presentation.slide#1) ([source](https://github.com/davecheney/go-1.8-release-party)) - -_Please send PR's with corrections/additions_ - -[Here's a link to the _draft_ Go 1.8 release notes](http://beta.golang.org/doc/go1.8). - -[Here's a link](https://talks.golang.org/2017/state-of-go.slide/) to the talk by Francesc Campoy: The State of Go (February 2017). - -### What'll happen if Go 1.8 comes out before the 16th? -This is likely to happen, but many meetups have a January date scheduled and don't want to hold two meetups so close together. The 16th is an arbitrary date that a quorum of meetups could find that didn't conflict with their existing schedules. - -If you're a meetup organiser and can hit the Feb 16th, awesome, but your participation is more important than being able to organise your group for an exact date. - -### What'll happen if Go 1.8 isn't out by the 16th? -Well ... at least we'll have each other. - -The feature set of Go 1.8 isn't going to change in over the next month. If Go 1.8 ships after the 16th, it will be a little anticlimactic that we jumped the gun, but it's not a big deal. - -### Who's organising this? -Well, if you run a Go meetup, you are. It can't be a worldwide release party without meetups around the globe. - -#### No, seriously, who's organising this? -Here are the organisers so far: -- [Dave Cheney](mailto://dave@cheney.net) - @davecheney -- [João Henrique Machado Silva](mailto://joaoh82@gmail.com) - [@joaoh82](https://twitter.com/joaoh82) - -_Want to help? Edit this page and add yourself_ - -If you have questions, please reach out to one of the organisers. \ No newline at end of file diff --git a/Go-Community-Slides.md b/Go-Community-Slides.md index 1b1a02fd..cd263f84 100644 --- a/Go-Community-Slides.md +++ b/Go-Community-Slides.md @@ -1,27 +1,4 @@ -Did you speak at a conference or meetup lately? Please share links to your slide decks here for better distribution to our global community. +The Go wiki on GitHub has moved to go.dev (#61940). +Try or . -# Peer To Peer Groups - -## Kitchener-Waterloo, Canada - -### Concurrent Optimization Methods Using Go - -Brodie Roberts, June 12, 2018 [[repo](https://github.com/indexexchange/GoOptimizationMethods)] - -Concurrency is a powerful tool for doing huge amounts of computation on today's multi-core computers. But that power is limited by the design of paralleling the problem and its implementation using threads and locks. We'll start with a sub-optimal concurrent Go program and walk through improving it - iterating on finding the program's bottleneck, improving it, and seeing the program get faster. We'll also cover general tips and tricks of concurrent optimization to apply to your own computationally intensive programs. - - -# Conferences -## [GopherCon 2018](http://gophercon.com/), Denver, Colorado - -### The Importance of Beginners -Natalie Pistunovich, August 29 - -* [Session details](https://www.gophercon.com/agenda/session/16875) -* [Slides](https://github.com/Pisush/Public-Speaking/blob/master/Slides/gopherconUS.pdf) - -### Rethinking Classical Concurrency Patterns -Bryan C. Mills, August 28 - -* [Slides with speaker notes](https://drive.google.com/file/d/1nPdvhB0PutEJzdCq5ms6UI58dp50fcAN/view?usp=sharing) \ No newline at end of file diff --git a/Go-Release-Cycle.md b/Go-Release-Cycle.md index 06a0ba75..6b843a55 100644 --- a/Go-Release-Cycle.md +++ b/Go-Release-Cycle.md @@ -1,174 +1,4 @@ -This wiki page is maintained by the Go team. Please -[send comments to golang-dev](https://groups.google.com/group/golang-dev) or -[file issues](https://go.dev/issue) instead of making changes directly. +The Go wiki on GitHub has moved to go.dev (#61940). -Short link: https://go.dev/s/release. +Try or . -## Overview - -Go is released every six months. Each release cycle is broken down into a -development phase lasting about 4 months, followed by a 3-month period of -testing and polishing called the release freeze. If everything goes well, work -on the next release begins before the previous release has shipped, resulting in -an overlap of about a month. - -After the initial release of a version, it is supported with minor releases that -fix severe bugs and security issues. - -## Timeline - -The current release cycle is aligned to start in mid-January and mid-July of -each year. The target milestones for a release cycle are as described below. We -try to hit the targets as closely as possible, while still delivering a quality -release. - -To give the team time to prepare, and to address unexpected problems, we prefer -to do release work early or mid-week. That means that exact dates will vary year -to year, so milestones are specified as weeks in a particular month. Week 1 is -the week starting on the first Monday of the month. All dates are subject to -change based on the year's holiday timings. - -![release](https://user-images.githubusercontent.com/24611692/228010841-fb299331-e7e3-4e64-85dc-66261ce22ea3.svg) - -#### January / July week 1: Planning for release begins. - -Planning of major work for upcoming release cycle is announced on -[golang-dev](https://groups.google.com/group/golang-dev). - -Example: [Go 1.20](https://groups.google.com/g/golang-dev/c/V8ez4YunkeE) - -#### January / July week 3: Release work begins. - -Once the prior release has entered its final stabilization period, the tree -opens for general development. All kinds of development are welcome during this -period. It's preferable for large or particularly risky changes to land well -before the end of the development window, so that there's time to fix any -problems that arise with them. - -#### May / November week 4: Release freeze begins. - -This milestone begins the second part of the release cycle, the release freeze. -The release freeze applies to the entire main repository as well as to the code -in subrepositories that is needed to build the binaries included in the release, -particularly vet and all its dependencies in the tools subrepository. - -During the freeze, only bug fixes and doc updates are accepted. On occasion new -work may be done during the freeze, but only in exceptional circumstances and -typically only if the work was proposed and approved before the cutoff. Such -changes must be low risk. See [freeze exceptions](#freeze-exceptions) below. - -This part of the release cycle is focused on improving the quality of the -release, by testing it and fixing bugs that are found. However, every fix must -be evaluated to balance the benefit of a possible fix against the cost of now -having not as well tested code (the fix) in the release. Early in the release -cycle, the balance tends toward accepting a fix. Late in the release cycle, the -balance tends toward rejecting a fix, unless a case can be made that the fix is -both low risk and high reward. - -Examples of low risk changes appropriate late in the cycle include changes to -documentation and fixes to new features being introduced in the current release -(since there is no chance of introducing a regression compared to an earlier -release). - -Shortly after the freeze begins, nearly all known bugs should have been fixed or -explicitly postponed (either to the next release or indefinitely). The remainder -should usually be tracked as release blockers and worked on urgently. - -#### June / December week 2: Release candidate 1 issued. - -A release candidate is meant to be as close as possible to the actual release -bits. Issuing a release candidate is an indication that the Go team has high -confidence that the tree is free of critical bugs. In particular, because Google -continuously tracks the development version of Go, by the time a release -candidate is issued, a close approximation of it will have been running in -production at Google for at least a week or two. - -Once a release candidate is issued, only documentation changes and changes to -address critical bugs should be made. In general the bar for bug fixes at this -point is even slightly higher than the bar for bug fixes in a minor release. We -may prefer to issue a release with a known but very rare crash than to issue a -release with a new but not production-tested fix. - -If critical bugs are reported and fixed, additional release candidates may be -issued, but typically not more than one every two weeks. - -Again, a release candidate is meant to be bug-free, as much as possible. -Organizations are encouraged to deploy it in production settings after -appropriate organization-specific testing. - -The calm period between a release candidate and the final release is a good time -for additional testing or for discussing the next release (see the planning -milestone above). - -#### July / January week 3: Work on the next release begins - -While the current release is being stabilized, the tree reopens for work on the -next. During this period, fixes intended for the current release need to be -[cherry-picked onto the release branch](https://go.dev/wiki/MinorReleases#making-cherry-pick-cls). -Unlike cherry-picks for minor releases, these changes don't need a backport -issue and don't need to be approved by the release team. As long as they're -permitted by the [freeze policy](#may--november-week-4-release-freeze-begins), -they can be reviewed and submitted like any other CL. - -#### August / February week 2: Release issued. - -Finally, the release itself! - -A release should not contain significant changes since the last release -candidate: it is important that all code in the release has been well tested. -Issuing a release is an indication that release testing has confirmed the -release candidate's high confidence that the tree is free of critical bugs. - -Even if a release goes smoothly and there's spare time, we prefer to stay on -schedule. Extra testing can only improve the stability of a release, and it also -gives developers working on the Go release more time to think about and plan the -next release before code changes start pouring in again. - -By the time of the final release, Google will have been using this version of Go -for nearly two months. While Google's successful use does not guarantee the -absence of problems, our experience has been that it certainly helps improve the -quality of the release. We strongly encourage other organizations to test -release candidates as aggressively as they are able and to report problems that -they find. - -Once a release is stabilized, work on the next release, including code reviews -and submission of new code, can begin, and the cycle repeats. Note that if a -release is delayed, work on the next release may be delayed as well. - -## Release Maintenance - -A minor release is issued to address one or more critical problems for which -there is no workaround (typically related to stability or security). The only -code changes included in the release are the fixes for the specific critical -problems. Important documentation-only changes and safe test updates (such as -disabling tests), may also be included as well, but nothing more. Minor releases -preserve backwards compatibility as much as possible, and don't introduce new -APIs. - -Minor releases to address problems (including security issues) for Go 1.x stop -once Go 1.x+2 is released. For more about security updates, see the -[security policy](https://go.dev/security). - -See also the [MinorReleases](https://go.dev/wiki/MinorReleases) wiki page. - -## Freeze Exceptions - -Fix CLs that are -[permitted by the freeze policy](#may--november-week-4-release-freeze-begins) do -not need a freeze exception. - -Any exceptions to the freeze must be communicated to and explicitly approved by -the Go Release Team before the freeze. If you’d like to request an exception, -please file an issue in the issue tracker with "[freeze exception]" as a suffix -and include "CC @golang/release" ([example](https://go.dev/issue/42747)). We -will address any requests on a case-by-case basis with a strong preference for -not permitting changes after the freeze. - -## Historical note - -A version of this schedule, with a shorter development window, was originally -adopted for the Go 1.7 release in 2016. After years of difficult releases, -testing and process improvements in 2022 and 2023 led to a timely 1.19 release. -For 1.20, the development window was expanded with a late freeze and early thaw. -These changes were formalized for the 1.21 release. We anticipate continuing to -ship on time. diff --git a/Go2.md b/Go2.md index 93a03d27..26feff55 100644 --- a/Go2.md +++ b/Go2.md @@ -1,49 +1,4 @@ -# Go2 status +The Go wiki on GitHub has moved to go.dev (#61940). -This page tracks the status of "Go 2". +Try or . -We are currently seeking feedback on potential designs for improved error handling, error values, and generics: - -* [Announcement of Go2 Draft Designs](https://go.dev/blog/go2draft) -* [Go2 Error Handling, Generics, and Error Values](https://go.googlesource.com/proposal/+/master/design/go2draft.md) - -## Bugs - -* [Open Go2 bugs](https://github.com/golang/go/issues?q=is%3Aissue+is%3Aopen+label%3AGo2) - -## Talks - -* [GopherCon 2017: Russ Cox - The Future of Go](https://www.youtube.com/watch?v=0Zbh_vmAKvk) -* [GopherCon Russia 2018: Brad Fitzpatrick - Go: Looking back and looking forward](https://www.youtube.com/watch?v=ZCB-g2B4Y5A) (Go2 stuff is at about 20 minutes in) -* [Sydney Golang Meetup - Rob Pike - Go 2 Draft Specifications](https://www.youtube.com/watch?v=RIvL2ONhFBI) - -## Scope - -From talk above: - -* "maybe three major changes" -* plus minor housekeep tasks -* TBD - -Examples of major changes: - -* [versioning](https://github.com/golang/go/issues/24301) -* [generics](https://github.com/golang/go/issues/15292)? -* [simplified, improved error handling](https://github.com/golang/go/issues/21161)? -* ... - -Examples of housekeeping: - -* [Open Go2Cleanup bugs](https://github.com/golang/go/issues?q=is%3Aissue+is%3Aopen+label%3AGo2Cleanup) (please don't add this label to things without discussion) - -## Compatibility - -We do not want to break the ecosystem. Go 1 and Go 2 code must be able to interoperate in programs with ease. - -## Standard library - -The standard library would probably be versioned and permit out-of-cycle updates, but be included with Go releases. Maybe "encoding/foo" become shorthand for "golang.org/x/std/encoding/foo". TBD. Some package would probably get v2 major versions, but the v1 versions would be minimally maintained, at least for security. - -## Roadmap - -TBD \ No newline at end of file diff --git a/Go2ErrorHandlingFeedback.md b/Go2ErrorHandlingFeedback.md index 53ed6d3a..3381f5d7 100644 --- a/Go2ErrorHandlingFeedback.md +++ b/Go2ErrorHandlingFeedback.md @@ -1,277 +1,4 @@ -# Feedback re Go 2 Error Handling Draft Design +The Go wiki on GitHub has moved to go.dev (#61940). -This page is meant to collect and organize feedback and discussion -started with the Go 2 [error handling draft design](https://go.googlesource.com/proposal/+/master/design/go2draft-error-handling-overview.md). +Try or . -Please post feedback on your blog, Medium, GitHub Gists, mailing lists, Google Docs, etc. And then please link it here. - -Please help categorize the rest of the uncategorized proposals at the bottom. - -**Update, June 19, 2019** – Based on this feedback we have posted a [proposal for a try builtin](https://go.dev/design/32437-try-builtin), which produced significant feedback on #32437 ([threaded view here](https://swtch.com/try.html)). - -We've disabled comments on that issue until July 1 to give people time to experiment in their own code. We would very much like to see experience reports about using the general try approach in your own code, including trial conversions with [tryhard](https://github.com/griesemer/tryhard). Thanks! - -# Experience with the [“try proposal”](https://go.dev/design/32437-try-builtin) - -Add to this list: - -- TEMPLATE: Your Name, “[Title](URL)”, Month YYYY - -* * * - -# Requirements - -Discussions of the requirements for a new error handling method. - -- Warren Stephens, "[Go 2 `handle` should provide line number, source filename, version](https://github.com/warrenstephens/Go2ErrorHandlingFeedback)", December 2018 - -- Liam Breck, “[Requirements to Consider for Go 2 Error Handling](https://gist.github.com/networkimprov/961c9caa2631ad3b95413f7d44a2c98a)”, September 2018 - - - jimmyfrasche, "[Don't special case error or nil](https://gist.github.com/jimmyfrasche/f2cd6aff16db5e46c577da44ec0cfa72)", September 2018 - -- Matt Dee "[Error Handling Should Support Custom Error Types](https://gist.github.com/mattdee123/a04f95ef5639489668cafd9c3b675a8c)", August 2018 - -- Ian Lance Taylor, “[Incomplete list of criteria](https://github.com/golang/go/issues/21161#issuecomment-389380686)” from GitHub proposal discussion, May 2018 - -- Rob Pike (posted by @matjam) “[Simplicity is Complicated](https://www.youtube.com/watch?v=rFejpH_tAHM)”, December 2015 - - -# In support - -This includes supporting the existing chaining/stacking of handlers without changes. - - - Tokyo Gophers, "[In support comments from Go 2 feedback event](https://docs.google.com/document/d/1yTDMP0E9hlJyLnKyr-6XL84RogiiwDnk0fMg9HDOKkc/edit#heading=h.f7ryl4573bu9)", October 2018 - - - Adam Bouhenguel "[In support of more declarative error handling](https://gist.github.com/ajbouh/716f8daba40199fe4d4d702704f3dfcc)", August 2018 - - - Daniel Theophanes, "[Go 2 Design: Error Handling Net Win](https://docs.google.com/document/d/e/2PACX-1vSq487dLylRHjgtKV42EbTKHW1aHZaaso3MZ4HOG1OS-s8suOnR9WZz6ahzH4Kufs2vwKKDMhoj1_I6/pub)", August 2018 - -- Alexandru-Paul Copil, "[In Support, with slight modifications and considerations](https://gist.github.com/cpl/54ed073e20f03fb6f95257037d311420)", September 2021 - -## Example code - -Code changed to use the existing proposal. - -- Daniel Milde, "[Use check-handle draft syntax in gdu](https://github.com/dundee/gdu/pull/51)", May 2021 - -- Mateusz Czapliński, "[Converting a fragment of real code with error handling to Go 2 'design draft'](https://gist.github.com/akavel/62d90bdc43088574c638eb3b16301a92)", August 2018 - - - Blake Mizerany, “[How best to account for partial writes when using check/handle?](https://gist.github.com/bmizerany/fcd0348bda96edce05a4fc7426e47751)”, August 2018 - -# Against - -Critiques without counter-proposals - -- Pasha Osipyants, “[Error handling mechanism using current go possibilities](https://pkg.go.dev/github.com/pashaosipyants/errors)”, February 2019 - -- Anonymous, “[Go 2 Error Handling Non-Proposal](https://groups.google.com/d/topic/golang-nuts/1McP4_-oOpo/discussion)”, October 2018 - -- Stripe developers, “[Feedback on Go 2 draft designs](https://groups.google.com/d/msg/golang-nuts/3A_MpcNKg7k/DWiHBLArCAAJ)”, October 2018 - -- Tokyo Gophers, "[Against comments from Go 2 feedback event](https://docs.google.com/document/d/1yTDMP0E9hlJyLnKyr-6XL84RogiiwDnk0fMg9HDOKkc/edit#heading=h.fy8rnze9tll5)", Oct 2018 - -- Liam Breck, “[Golang, How dare you handle my checks!](https://medium.com/@mnmnotmail/golang-how-dare-you-handle-my-checks-d5485f991289)”, September 2018 - -- Nate Finch, "[Handle and Check, Let's Not](https://npf.io/2018/09/check-and-handle/)", September 2018 - -- Jozef Slezak, "[Use semicolons instead of new keywords: check+handle](https://gist.github.com/jozef-slezak/93a7d9d3d18d3fce3f8c3990c031f8d0)", September 2018 - -- Shannon Wynter "[Error Handling as it can already be done](https://gist.github.com/freman/0b372e46c72f6a27652538b9930ee851)", August 2018 - - -# Recurring themes - -Concepts that appear repeatedly among the suggestions below. - -- Invoke handler via assignment, e.g. `v, ? := f()` - references: - [1](https://gist.github.com/oktalz/f04f36a3c2f61af22c7a6e06095d18eb), - [2](https://gist.github.com/pborman/c69e79690d86dfc5c371f096be22930c), - [3](http://blog.oldcloudguy.com/2019/04/18/error-handling-in-go-2-draft/), - [4](https://github.com/rockmenjack/go-2-proposals/blob/master/error_handling.md), - [5](https://gist.github.com/the-gigi/3c1acfc521d7991309eec140f40ccc2b), - [6](https://gist.github.com/8lall0/cb43e1fa4aae42bc709b138bda02284e), - [7](https://gist.github.com/dpremus/3b141157e7e47418ca6ccb1fc0210fc7), - [8](https://gist.github.com/bserdar/4c728f85ca30de25a433e84ad5a065a1), - [9](https://gist.github.com/mcluseau/1c20c3973fa3acb544d0505637be8d67), - [10](https://didenko.github.io/grab/grab_worth_it_0.1.1.html), - [11](https://github.com/gooid/gonotes/blob/master/inline_style_error_handle.md), - [12](https://gist.github.com/Kiura/4826db047e22b7720d378ac9ac642027), - [13](https://github.com/golang/go/issues/27519), - [14](https://gist.github.com/lldld/bf93ca94c24f172e95baf8c123427ace) - -- Invoke one of several handlers by name, e.g. `v := check f() ? name` - references: - [1](https://didenko.github.io/grab/grab_worth_it_0.1.1.html), - [2](https://gist.github.com/forstmeier/b6c6a6d2f6f2f72a81a076322959c959), - [3](https://gist.github.com/mcluseau/1c20c3973fa3acb544d0505637be8d67), - [4](https://gist.github.com/the-gigi/3c1acfc521d7991309eec140f40ccc2b), - [5](https://gist.github.com/PeterRK/4f59579c1162cdbc28086f6b5f7b4fa2), - [6](https://gist.github.com/marlonche/4e5d4e5aec0555958ec1f181991325f6), - [7](https://github.com/alnkapa/Go2ErrorHandlingFeedback/blob/master/README.md), - [8](https://medium.com/@phlatphrog/handling-more-than-just-errors-in-go-f97c5aa2eac4), - [9](https://gist.github.com/gregwebs/02479eeef8082cd199d9e6461cd1dab3), - [10](https://github.com/gooid/gonotes/blob/master/inline_style_error_handle.md), - [11](https://gist.github.com/spakin/86ea86ca48aefc78b672636914f4fc23), - [12](https://gist.github.com/morikuni/bbe4b2b0384507b42e6a79d4eca5fc61), - [13](http://devmethodologies.blogspot.com/2018/10/go-error-handling-using-closures.html), - [14](https://gist.github.com/bserdar/4c728f85ca30de25a433e84ad5a065a1), - [15](https://medium.com/@marode/the-return-of-the-return-278b8ae261ab), - [16](https://gist.github.com/dpremus/3b141157e7e47418ca6ccb1fc0210fc7), - [17](https://github.com/golang/go/issues/27519) - - -# Modest revisions - - Leidong Liu, "[a, b, !checkError := Sub(...)](https://gist.github.com/lldld/bf93ca94c24f172e95baf8c123427ace)", Nov 2019 - - - Jin Feng, "[A simplified Go 2 error handling solution with no handler], (https://gist.github.com/jfeng45/416d4ecb42a4df50bebf86ce1c41c668)", July 2019 - - - Dave Arnold, "[Move special check keyword to left-hand side of assignment](http://blog.oldcloudguy.com/2019/04/18/error-handling-in-go-2-draft/)", April 2019 - - - Rockmen, "[Add handle and ? as syntax sugar maybe](https://github.com/rockmenjack/go-2-proposals/blob/master/error_handling.md)", December 2018 - - - Steve Manuel, "[Go 2 `handle` statement to optionally use a type switch](https://github.com/golang/go/issues/28344)", October 2018 - -- Zlatko Bratkovic, "[In support with tiny change](https://gist.github.com/oktalz/f04f36a3c2f61af22c7a6e06095d18eb)", October 2018 - -- DeedleFake, "[Possible Solution to `check` Awkwardness with Chained Method Calls](https://gist.github.com/DeedleFake/5e8e9e39203dff4839793981f79123aa)", September 2018 - -- Yesuu Zhang, "[Pass the check and handle parameters, custom handle](https://github.com/yesuu/go-proposal/blob/master/go2errorhanding.md)", September 2018 - - - Viktor Kojouharov, "[Reducing the special casing around the new error design draft](https://gist.github.com/urandom/6519990ef9eb7547e888a5f2da7f1a93)", September 2018 - -- Aleksei Pavliukov, “[Use a function as a handle parameter](https://github.com/a5i/go-proposal/blob/master/use%20a%20function%20as%20a%20handle%20parameter.md)”, September 2018 - -- Savino Pio Liguori, "[Feedback for Go2 error handling design](https://gist.github.com/8lall0/cb43e1fa4aae42bc709b138bda02284e)", August 2018 - - - Jeffrey Koehler, "[In support of Handle Chaining; On Check](https://gist.github.com/deef0000dragon1/eb224ce4918d4ec3bdbaedf83a32aeb1)", August 2018 - - - Garrus, "[Another style of syntactic sugar on error handling](https://gist.github.com/garrus/5b1f73a7640726c92273700eabed9056)", August 2018 - - - Paul Borman, "[Arguments against the Go 2 error handling proposal](https://gist.github.com/pborman/c69e79690d86dfc5c371f096be22930c)", August 2018 - - - krhubert, "[Error default handler for tests](https://go.dev/issue/32361)", May 2019 - - - Franz, Implement error handling like an invariant check of a variable. when the value changes, a function is called. this can then be used in other situations too. - -- Brandon Heenan, "[Concise, with more obvious control flow](https://github.com/bmheenan/goerr/blob/main/README.md)", May 2021 - -## Remove handler chaining - -- Markus Heukelom, "[proposal: Improve error handing using `guard` and `must` keywords](https://github.com/golang/go/issues/31442)", April 2019 - - - Alessandro Arzilli, “[Against check as an operator and handler chains](https://gist.github.com/aarzilli/1a85db632edecc8159505e2c785882ed)”, August 2018 - -- Simon Howard, “[Go 2 errors response: One Handler Per Function](https://gist.github.com/fragglet/df6c5471771d87b2ad597d2efc57cb3e)”, August 2018 - -- Eli Bendersky, "[Thoughts on the Go 2 Error Handling proposal](https://gist.github.com/eliben/d0c872054864bfc1110ec761c3c53c47)", September 2018 - -- Yoshiki Shibukawa, "[Every handles should have return statement](https://gist.github.com/shibukawa/42a9dee400c2f8577b4a763bcb1a5e5f)", September 2018 - - -# Counter-proposals - -## Error handling with normal functions - -- Azamat Kalberdiev, “[Handling every error with intuitive code](https://gist.github.com/Azamat28/5b2c6f66fc4927a002a2d60044aa9231)”, March 2021 - -- Andrew Phillips, “[Use closures rather than handlers](http://devmethodologies.blogspot.com/2018/10/go-error-handling-using-closures.html)”, October 2018 - - - Taihei Morikuni, "[Use functions as an error handler, Add syntactic sugar to remove duplicated if statement](https://gist.github.com/morikuni/bbe4b2b0384507b42e6a79d4eca5fc61)", September 2018 - -- Scott Pakin, "[Go 2 error handling based on non-local returns](https://gist.github.com/spakin/86ea86ca48aefc78b672636914f4fc23)", September 2018 - -- Greg Weber "[Error handling with functions and an error return?](https://github.com/golang/go/issues/27567)", September 2018. Originally linked [gist](https://gist.github.com/gregwebs/02479eeef8082cd199d9e6461cd1dab3). - -- Gigi Sayfan, “[Go 2 error handling feedback + alternative solution](https://gist.github.com/the-gigi/3c1acfc521d7991309eec140f40ccc2b)", September 2018 - -- Ruan Kunliang, "[Simple Error Handling for Go 2](https://gist.github.com/PeterRK/4f59579c1162cdbc28086f6b5f7b4fa2)", August 2018 - -- Martin Rode, "[The return of the return, Error Handling for Go 2](https://medium.com/@marode/the-return-of-the-return-278b8ae261ab)", November 2018 - -## Labeled error handlers - -- Joe Lapp, "[Local-only throw-catch error handling](https://github.com/golang/go/issues/48896)", October 2021 - -- Danijel Premus, "[Use existing go labels](https://gist.github.com/dpremus/3b141157e7e47418ca6ccb1fc0210fc7)", December 2018 - -- Burak Serdar, "[Handler for err declares both err and errHandler, less intrusive labeled error handling](https://gist.github.com/bserdar/4c728f85ca30de25a433e84ad5a065a1)", October 2018 - -- John Forstmeier, "[Labeled error handling](https://gist.github.com/forstmeier/b6c6a6d2f6f2f72a81a076322959c959)", September 2018 - -- Mikaël Cluseau, "[Multiple handlers, unambiguous on which return value is used](https://gist.github.com/mcluseau/1c20c3973fa3acb544d0505637be8d67)", September 2018 - -- Kiura Magomadov, “[Addition to Go2 draft error handling](https://gist.github.com/Kiura/4826db047e22b7720d378ac9ac642027)", September 2018 - -- Liam Breck, “[The `#id/catch` Error Model](https://github.com/golang/go/issues/27519)”, September 2018 - -- Marlon Che, "[How about separating check and handle?](https://gist.github.com/marlonche/4e5d4e5aec0555958ec1f181991325f6)", August 2018 - -## Inlining - -- Patrick Kelly, "[handling more than just errors in go](https://medium.com/@phlatphrog/handling-more-than-just-errors-in-go-f97c5aa2eac4)", August 2018 - -- Vlad Didenko, “[Error Handling with `grab | name()`](https://didenko.github.io/grab/grab_worth_it_0.1.1.html)”, November 2017 - -- Gooid, “[Inline style error handle(simple unambiguous)](https://github.com/gooid/gonotes/blob/master/inline_style_error_handle.md)”, August 2018 - -## Use defer - - - Victoria Raymond, “[Force 'check' to return error instead of allowing customized logic](https://gist.github.com/VictoriaRaymond/d70663a6ec6cdc59816b8806dccf7826)”, August 2018 - - - Night-walker and daokoder, "[Extend and repurpose defer instead of introducing new syntax](https://github.com/daokoder/dao/issues/191#issuecomment-44784919 )", June 2014 - -## try/catch/finally syntax - -- Mathieu Devos, "[Go2 Error Handling Proposal: Scoped Check/Handle](https://gist.github.com/mathieudevos/2bdae70596aca711e50d1f2ff6d7b7cb)", August 2018 - -- Rust RFC, “[Trait-Based Exception Handling (wherein `catch` is akin to `try`)](https://github.com/rust-lang/rfcs/blob/master/text/0243-trait-based-exception-handling.md)”, February 2016 - -- ZhiFeng Hu, "[[Go2ErrorHandling] Go should support Exception handler](https://www.netroby.com/view/3910)", August 2018 - -- Jan Semmelink, “[if-else-undo-done](https://gist.github.com/jansemmelink/235228a0fb56d0eeba8085ab5f8178f3)”, August 2018 - -- Vladimir Utoplov, "[Handling throws/throw idiom](https://gist.github.com/trashgenerator/d58e05522d2f83709e1a601564b68fee)", September 2018 - -- Gokan EKINCI, "[try-with-resources](https://gist.github.com/eau-de-la-seine/9e2e74d6369aef4a76aa50976e34de6d)", December 2018 - -## Other possibilities - -- Alex Hornbake, "[refuse. conditional return keyword](https://gist.github.com/alexhornbake/6a4c1c6a0f2a063da6dda1bf6ec0f5f3)", June 2019 - -- yaxinlx, "[Use ? as suffix to remove the last error value from multi-value tuples](https://gist.github.com/yaxinlx/1e013fec0e3c2469f97074dbf5d2e2c0)", March 2019 - -- Plamen Stoev, "[Go 2 block-level checks](https://gist.github.com/coquebg/afe44e410f883a313dc849da3e1ff34c)", November 2018 - -- Peter Goetz, "[Formalize and Enforce Error Handling](https://medium.com/@peter.gtz/thinking-about-new-ways-of-error-handling-in-go-2-e56d116952f1)", September 2017 - - - Fedir RYKHTIK, "[Go 2 error handling with exclamation mark](https://gist.github.com/fedir/50158bc351b43378b829948290102470)", September 2018 - - - Einthusan Vigneswaran, “[Error Aware Keywords - return, defer, if, != and forcing the error object to be the last argument](https://gist.github.com/einthusan/24e18f6359a31b3537815284cde0f6de)”, September 2018 - -- Andrew Phillips, “[Improving Go Error Handling](http://devmethodologies.blogspot.com/2017/10/improving-go-error-handling.html)”, October 2017 - - -# Uncategorized - -Please help categorize the rest of the proposals here. - -- Joe Lapp, "[`on...return` for error handling](https://github.com/golang/go/issues/48855)", Oct 2021 - -- Andrew Gwozdziewycz, "[Check for Go Errors](http://sigusr2.net/check-for-go-errors.html)", June 2019 - -- DeedleFake, "[Feedback for Go 2 Design Drafts](https://deedlefake.com/2018/08/feedback-for-go-2-design-drafts/)", August 2018 - -- Loki Verloren, “[Go 2 error handling feedback and my thoughts on how to improve programmer's efficiency and experience](https://gist.github.com/l0k1verloren/8aec03b8c48fdb5d3dab3a77153ce162)”, September 2018 - -- Gima, "[Procedural code, separate error handling](https://gitlab.com/snippets/1726097)", June 2018 - -- Konstantin, "[error handling for error-tree](https://github.com/Konstantin8105/Go2ErrorTree)", [Discyssion](https://github.com/golang/go/issues/32099) May 2019 - -## Adding your feedback - -Please format all entries as below. - -- _Your Name_, “[_Title_](#URL)”, _month year_ - -To make it easier to see new feedback, please add your new proposal to the top of the section it is placed in. \ No newline at end of file diff --git a/Go2ErrorValuesFeedback.md b/Go2ErrorValuesFeedback.md index 3ed69dc4..3710acb9 100644 --- a/Go2ErrorValuesFeedback.md +++ b/Go2ErrorValuesFeedback.md @@ -1,58 +1,4 @@ -# Go 2 Error Values Feedback +The Go wiki on GitHub has moved to go.dev (#61940). -This page is meant to collect and organize feedback about the Go 2 [error values draft designs](https://go.googlesource.com/proposal/+/master/design/go2draft-error-values-overview.md). +Try or . -Please post feedback on your blog, Medium, GitHub Gists, mailing lists, Google Docs, etc. And then please link it here. - -As the amount of feedback grows, please feel free to organize this page by specific kind of feedback. - -### Further Background - -- Ben Johnson, "[Failure is Your Domain](https://middlemost.com/failure-is-your-domain/)", June 2018 - -### Draft Implementation - -- Go Team, “[x/exp/errors](https://pkg.go.dev/golang.org/x/exp/errors)”, November 2018 - -- Torben Schinke, “[Implementation of the draft design](https://github.com/worldiety/errors)”, December 2018 - -### Error Inspection - - - Ilya Sinelnikov, "[`Is` and `As` differ in behavior which is unexpected](https://github.com/sidh/go2errorsinspection)", December 2018 - - Roger Peppe, "[Some thoughts about the draft Go error inspection design](https://gist.github.com/rogpeppe/a435b57473152e3429a5a149401edacf)", November 2018 - - Greg Weber, “[Horizontal composition: Error inspection for groups](https://gist.github.com/gregwebs/5a14a83970d607411310a3e0281d55be)”, September 2018 - - Eyal Posener, "[Reply](https://gist.github.com/gregwebs/5a14a83970d607411310a3e0281d55be#gistcomment-2710662)", September 2018 - - K. Alex mills, "[Rename Wrapper to Unwrapper](https://gist.github.com/kalexmills/46c2cb276c69b659005d8705180b268a)", September 2018 - - jimmy frasche, "[Why limit this inspection to errors?](https://gist.github.com/jimmyfrasche/04ca2146c9130dab4d993365313722fb)", August 2018 - - Dan Kortschak, [Carrying contract expectations and values causing errors in ev3go](https://github.com/ev3go/ev3dev/blob/master/errors.go), August 2018 - - Daniel Theophanes, "[Go 2 Design: Error Inspection with Error Lists](https://docs.google.com/document/d/e/2PACX-1vT-CPcBV53awF7vq5bJEi1Y_DkuVmWW0RWl-gsujByB1mjX67rH58-mex1on1waR4Q_gyhPu5TdghMv/pub), August 2018 - - Cosmos Nicolaou "[Inspection of errors in a different address space](https://github.com/cosnicolaou/core/wiki/go-2.0-error-handling-feedback)", September 2018 -- Chris Siebenmann, "[Error inspection improves current annoyances but may not go far enough](https://utcc.utoronto.ca/~cks/space/blog/programming/Go2ErrorInspectionViews)", September 2018 - - Paul Meyer, “[errors.New?]( - _Your Name_, “[_Title_](#URL)”, August 2018 - - Vojtech Vitek "[adopt Cause and Wrap from github.com/pkg/errors](https://go.dev/issue/25675)", May 2018 - - Andrew Wilkins "[Programmatic Frame inspection](https://gist.github.com/axw/247b6f69d2da016bb21a5eb1be44e611)", January 2019 -- _Carl Johnson_, "[_`As()` and `Is()` are useful for optional interfaces beyond error_](https://gist.github.com/carlmjohnson/d06cd8d10e0aef65f565a55cc57cd986), Feb. 2019 - - ques0942, "[xerrors has less feature about trace's detail](https://dev.to/ques0942/xerrors-has-less-feature-about-traces-detail-4861)", Mar. 2019 - - _Your Name_, “[_Title_](#URL)”, _month year_ - - etc. - -### Error Printing - - - Calle Pettersson, [Multi-line errors and log collection tools](https://gist.github.com/carlpett/bc1714060235edc0ad3fd9ead82f4ce6)”, August 2018 - - jimmy frasche, "[Why limit these interfaces to errors?](https://gist.github.com/jimmyfrasche/e02fcbefee5cb14228768afec17abbee)" , August 2018 - - Chris Hines, “[Types cannot implement both the errors.Formatter and fmt.Formatter interfaces -](https://gist.github.com/ChrisHines/a732a9b1ef3acb6acfee2ccc174e31ed)”, _August 2018_ - - Dean Bassett, “[Make errors.Detailer, not errors.Formatter](https://gist.github.com/deanveloper/61544f16a7d4c3d517bda10c08080270)”, _September 2018_ - - Bryan C. Mills, “[Error Wrapping and Redundancy in Go](https://github.com/bcmills/go-experience-reports/blob/master/errors.md)”, _September 2019_ - - _Your Name_, “[_Title_](#URL)”, _month year_ - - etc. - -### Misc - -- TJ Holowaychuk, [Structured access for structured logging](https://gist.github.com/tj/638adb053f802e6c19686bd2fee443b7), April, 2019 -- Andrew Chambers, [My current error approach](https://gist.github.com/andrewchambers/5cadb2b8b45271440f1a051bb1ccc9c6), August, 2018 -- mikioh, [A walkthrough on Error Values for issue 18183](https://gist.github.com/mikioh/93f575120ded671bad18491ecf41743d), October, 2018 - -### Against Any Change At All - -- Rob Pike - [Simplicity is Complicated](https://www.youtube.com/watch?v=rFejpH_tAHM), December 2015 \ No newline at end of file diff --git a/Go2GenericsFeedback.md b/Go2GenericsFeedback.md index b59e40db..5c32efe9 100644 --- a/Go2GenericsFeedback.md +++ b/Go2GenericsFeedback.md @@ -1,366 +1,4 @@ -# Go 2 Generics Feedback +The Go wiki on GitHub has moved to go.dev (#61940). -This page is meant to collect and organize feedback about the Go 2 [contracts (generics) draft design](https://go.googlesource.com/proposal/+/master/design/go2draft-generics-overview.md). +Try or . -A prototype implementation of the syntax can be found in https://go.dev/cl/149638 which may be -patched on tip of the Go repo. - -Please post feedback on your blog, Medium, GitHub Gists, mailing lists, Google Docs, etc. And then please link it here. - -As the amount of feedback grows, please feel free to organize or reorganize this page by specific kind of feedback. - -## Supporting - -- Roger Peppe, "[Go contracts use case: generic mgo](https://gist.github.com/rogpeppe/cbbaf2521749717137625e33ba203eed)", September 2018 - -- Richard Fliam, "[Go2 Generics Let You Construct the Natural Numbers](https://gist.github.com/rfliam/c806a4300aa97f2762295ef97d3e924f)", August 2018 - -- Roger Peppe, "Go generics at runtime", [Part 1](https://gist.github.com/rogpeppe/f9216e5f2b1c99fc13108825dbda6181), [Part 2](https://gist.github.com/rogpeppe/9fa9a267472fb80e9ddc4a940aa26e14), September 2018 - -## Supplemental (supporting with modifications) - -- Matt McCullough, "[Towards Clarity: Syntax Changes for Contracts in Go](https://gist.github.com/tooolbox/6bde6925a1a8c78cb593b2c11e977b07)" and "[Angle Brace Delimiters for Go Contracts](https://gist.github.com/tooolbox/fb385bfa05032ddc989afb393948be48)", May 2020 - -- Gert Cuykens, "[Complete separation of generic syntax form regular Go code](https://github.com/golang/go/issues/36533)", Januari 2020 - -- Court Fowler, "[Thoughts from a lazy programmer on the updated design](https://gist.github.com/courtf/ec509e0acdba6a4367a72733a8a5e61b)", September 2019 - -- Andrew Phillips, "[Example Types as Contracts](https://devmethodologies.blogspot.com/2019/08/example-types-as-contracts.html)", August 2019 - -- Alexey Nezhdanov, "[A syntax simplification proposal](https://gist.github.com/snakeru/aebc533b14a3f045f2bbb0d8eda5ed27)", August 2019 - -- Bryan Ford, "[Are Only Type Parameters Generic Enough for Go 2 Generics?](https://bford.info/2019/07/29/go-generics/)", July 2019 - -- Tom Levy, "[Go 2 Generics Feedback](https://gist.github.com/tom93/fd8c500b8a1d2d94f227e1e108d5315b)", June 2019 - -- Ole Bulbuk, "[Why Go Contracts Are A Bad Idea In The Light Of A Changing Go Community](https://flowdev.github.io/2019/04/02/why-go-contracts-are-a-bad-idea-in-the-light-of-a-changing-go-community/)", April 2019 - -- Tony Mottaz, "[Go generic types and import injection](https://gist.github.com/awmottaz/4c63c4f2067a265fac2cd8cc46e25404)", March 2019 - -- Gustavo Bittencourt, "[Contracts only for Generic Types](https://gist.github.com/gbitten/9faf20886728d3750e106e352c31f0e9)", March 2019 - -- David Heuschmann, "[Problems With Using Parantheses for Type Argument Lists](https://gist.github.com/dddent/6e4a7490f80cb427c0e910ebca5c3468)", February 2019 - -- Gustavo Bittencourt, "[Contract with methods](https://gist.github.com/gbitten/6e17ef81be876d70f624c711f5a3b0e2)", February 2019 - -- Chris Siebenmann, "[Go 2 Generics: Contracts are too clever](https://utcc.utoronto.ca/~cks/space/blog/programming/Go2ContractsTooClever)", November 2018 - -- Chris Siebenmann, "[Go 2 Generics: A way to make contracts more readable for people](https://utcc.utoronto.ca/~cks/space/blog/programming/Go2ContractsMoreReadable)", November 2018 - -- Chris Siebenmann, "[Go 2 Generics: Interfaces are not the right model for type constraints](https://utcc.utoronto.ca/~cks/space/blog/programming/Go2GenericsNotWithInterfaces)", November 2018 - -- alanfo, "[Proposed changes to the Go draft generics design in the light of feedback received](https://gist.github.com/alanfo/72f07362d687f625a958bde1808e0c87)", October 2018 - -- Andy Balholm "[Enumerated and structural contracts](https://gist.github.com/andybalholm/8165da83c10a48e56590c96542e93ff2)", October 2018 - -- Burak Serdar "[Types are contracts](https://gist.github.com/bserdar/8f583d6e8df2bbec145912b66a8874b3)", October 2018 - -- Patrick Smith, "[Go generics for built-in and user-defined type parameters](https://gist.github.com/pat42smith/ed63aca983d4ba14fdfa320296211f40)", September 2018 - -- Jacob Carlborg, "[Go 2 draft D corrections](https://gist.github.com/jacob-carlborg/b3c91a94f306564158b2a6ac58a57d50)", September 2018 - -- alanfo, "[A simplified generics constraint system](https://gist.github.com/alanfo/fb2438f376dac0db3be5664702f39aab)", September 2018 - -- Paul Borman, "[Simplifying syntax](https://gist.github.com/pborman/a6958ee6b7d6668e35fc99db07ea29e4)", September 2018 - -- mrwhythat, "[Go 2 generics draft notes](https://gist.github.com/mrwhythat/f5f2e1ea2bb9869082da55529586d972)", September 2018 - -- Roger Peppe, "[Operator overloading](https://gist.github.com/rogpeppe/0a87ef702189689201ef1d4a170939ac)", September 2018 - -- Peter McKenzie, "[Alternative generics syntax](https://gist.github.com/peter-mckenzie/5cc6530da1d966e743f4a39c150a6ac2)", September 2018 - -- Ted Singer, "[The design goal for syntax is to help humans read](https://gist.github.com/TedSinger/9ab1857bdd00d1f3523911362380f901)", September 2018 - -- alanfo, "[Suggested amendment to Go 2 generics draft design](https://gist.github.com/alanfo/5da5932c7b60fd130a928ebbace1f251)", September 2018 - -- Dean Bassett, "[If we're going to use contracts, allow unary + on string](https://github.com/golang/go/issues/27657), September 2018" - -- Kevin Gillette, "[Regarding the Go 2 Generics Draft](https://medium.com/@xtg/regarding-the-go-2-generics-draft-39f7815be89)", September 2018 - -- jimmy frasche, "[Embedding of type parameters should not be allowed](https://github.com/golang/go/issues/15292#issuecomment-417422599)", August 2018 - -- Javier Zunzunegui, "[Compiling Generics](https://gist.github.com/JavierZunzunegui/7032f5846fd255811e7af39bd2c74f38)", August 2018 - -- Liam Breck, “[Please Don't Mangle the Function Signature](https://gist.github.com/networkimprov/7c1f311f26852bc912765e4110af062b)”, August 2018 - -- DeedleFake, "[Feedback for Go 2 Design Drafts](https://deedlefake.com/2018/08/feedback-for-go-2-design-drafts/)", August 2018 - -- Roberto (empijei) Clapis, "[Hard to read syntax](https://gist.github.com/empijei/a9665ac5e3059671be229acee8826798)", August 2018 - -- Dominik Honnef, "[My thoughts on the Go Generics Draft](http://honnef.co/posts/2018/08/opinions-on-go-generics-draft/)", August 2018 - -## Counterproposals - -- dotaheor, "[Declare generics as mini-packages with generic parameters](https://github.com/dotaheor/unify-Go-builtin-and-custom-generics/blob/master/use-package-as-gen.md)", August 2020 - -- Beoran, "[Hygienic Macros](https://github.com/golang/go/issues/32620)", June 2019 - -- Randy O'Reilly, "[Generic Native Types](https://gist.github.com/rcoreilly/bfbee2add03c76ada82810423d81e53d)", June 2019 - -- Michal Štrba, "[Giving up restricting types](https://gist.github.com/faiface/e5f035f46e88e96231c670abf8cab63f)", May 2019 - -- Eric Miller, "[Simple generics using const struct fields](https://gist.github.com/HALtheWise/e7db03557ad52b9f9fa2722b4ef0f41e)", March 2019 - -- dotaheor, "[A solution to unify Go builtin and custom generics](https://github.com/dotaheor/unify-Go-builtin-and-custom-generics)", February 2019 - -- Quentin Quaadgras, [No syntax changes, 1 new type, 1 new builtin](https://gist.github.com/Splizard/df4c34ffe100c624c55ddaf45ac7eeb6), December 2018 - -- Andy Balholm, "[Contracts and Adaptors](https://gist.github.com/andybalholm/acecba3acf57bf1254142dadce928890)", November 2018 - -- Dean Bassett, "[Contract embedding](https://gist.github.com/deanveloper/9063720344d7a041795cba778d7de77c)", October 2018 - -- Patrick Smith, "[Go Generics with Adaptors](https://gist.github.com/pat42smith/ccf021193971f6de6fdb229d68215302)", October 2018 - -- Ian Denhardt, "[Go Generics: A Concrete Proposal Re: Using Interfaces Instead Of Contracts.](https://gist.github.com/zenhack/ad508d08c72fce6df945a49945ad826d)", October 2018 - -- Arendtio "[Generics in Go inspired by Interfaces](https://gist.github.com/arendtio/77dd4df5f4b19dc69da350648434a88a)", September 2018 - -- Scott Cotton, "[Draft Proposal Modification for Unifying Contracts and Interfaces](https://github.com/wsc1/proposal/blob/master/design/go2draft-contracts.md)" ([diff](https://github.com/golang/proposal/compare/master...wsc1:master)), September 2018 - -- ohir, "[CGG, Craftsman Go Generics](https://github.com/ohir/gonerics)", September 2018 - -- ~~Dean Bassett, "[Using interfaces instead of contracts](https://gist.github.com/deanveloper/c495da6b9263b35f98b773e34bd41104)", September 2018~~ - _I have made a second proposal ("contract embedding") listed further down that solves the issues with this one_ - -- dotaheor, "[Combine contract and code together and view generic as compile-time calls with multiple outputs](https://gist.github.com/dotaheor/4b7496dba1939ce3f91a0f8cfccef927)", September 2018. (Updated from time to time) - -- Aleksei Pavliukov, "[Extend type and func keywords](https://github.com/a5i/go-proposal/blob/master/generics.md)", September 2018 - -- Han Tuo, "[Generic as a kind of types -- type T generic {int, float64}](https://gist.github.com/hantuo/574aeda064c18eb69aa6806fbb259510)", September 2018 - -- Nate Finch, "[Go2 Contracts Go Too Far](https://npf.io/2018/09/go2-contracts-go-too-far/)", September 2018 - -- Roger Peppe, "[Go Contracts as type structs](https://gist.github.com/rogpeppe/7ea0cb6037aa520934257bf88a1012c5)", September 2018 - -- Axel Wagner, "[Scrapping contracts](https://blog.merovius.de/2018/09/05/scrapping_contracts.html)", September 2018 - -- Matt Sherman "[Generics as built-in typeclasses](https://clipperhouse.com/go-generics-typeclasses/)", September 2018 - -- Roger Peppe, "[Revised generics proposal](https://gist.github.com/rogpeppe/45f5a7578507989ec4ba5ac639ae2c69)", September 2018 - -- Steven Blenkinsop, “[Response to the Go2 Contracts Draft Design – Auxiliary Types](https://gist.github.com/stevenblenkinsop/7b967bb98f876b99dc15620f9fda9eb1)”, September 2018 - -- Dave Cheney, "[Maybe adding generics to Go IS about syntax after all](https://dave.cheney.net/2018/09/03/maybe-adding-generics-to-go-is-about-syntax-after-all)", September 2018 - -- Christian Surlykke, "[Constraints for Go Generics](https://github.com/surlykke/Go-Generics-with-constraints/tree/V2.0), September 2018" - -- Some Gophers on go-nuts, “[Unifying Interfaces and Contracts](https://groups.google.com/forum/#!topic/golang-nuts/aw3XQV8k1Vw)”, August 2018 - -- Roger Peppe, "[Go generics feedback](https://gist.github.com/rogpeppe/2be10112c9d875afc0c85effc5595a09), August 2018 - -- Ruan Kunliang, "[Package level generics](https://gist.github.com/PeterRK/41d4d3f54b8db55cd616403fd5a389f3)", August 2018 - -- Emily Maier, "[Getting specific about generics](https://emilymaier.net/words/getting-specific-about-generics/)", August 2018 - -## Against - -- Tokyo Gophers, "[Comments from Go 2 draft design feedback event](https://docs.google.com/document/d/1O6w4eL6ChROXrJ2vw9IhezzsdG7n8ToMnGnYLRQbjQg/edit?usp=sharing)", October 2018 - -* Jason Moiron, "[Notes on the Go2 Generics Draft](http://jmoiron.net/blog/notes-on-the-go2-generics-draft)", September 2018 - -* Yoshiki Shibukawa, "[Feedback for generics/contract proposals](https://gist.github.com/shibukawa/9c9eba1e68c3721f96b6f1456cfc4271), September 2018" - -## Adding Your Feedback - -Please format all entries as below. - -- _Your Name_, “[_Title_](#URL)”, _month year_ - -To make it easier to see new feedback. Please _make a Gist_. And also help to keep the list sorted in reverse-chronological order by including your new entry at the _top_ of the category list. - -## Quick comments -- [Chester Gould](https://github.com/Techser/): The only problem with this proposal is that explicit contracts seem to only make the code more verbose which is against the goal of simple readable code. Instead of writing explicit contracts, using the actual code we write as a kind of "implicit contract" would be much more simple and elegant. An example of this is shown [here](https://gist.github.com/Techser/72945cef3e5755d0ea0b8fd113fc25c7). I acknowledge that this is addressed [here](https://go.googlesource.com/proposal/+/refs/heads/master/design/go2draft-contracts.md#type-contracts), but I disagree that explicit contracts are the solution to problem. It seems to me that contracts are very close to what interfaces provide and so the behaviour of interfaces should be extended to allow behaviour closer to contracts rather than adding an entire new type of statement to the language. - -- [Izaak Weiss](https://github.com/lalaithion): A lot of the discussion has focused specifically on how to implement contracts, or something like that. However, most of the "useful examples" don't require contracts; they only require parametric polymorphism. Writing a typesafe `Merge` or `SortSlice` is possible without contracts. And for the simpler contracts, we can implement them via higher order functions. A generic hashmap can be parametric over a type with a `Hash` method, or it can take a `func(K) int64` when it is constructed, and use that to hash its keys. If more functions are required, structs holding these functions can be declared as pseudo-contracts, and then those can be passed to the generic function. This makes Go's polymorphism simple, explicit, and leaves room for further innovation regarding contracts or other mechanisms in the future, while allowing most of the benefits of generic types to be realized right now. - -- [Christoph Hack](https://github.com/tux21b): I just watched Alexandrescu's last talk [The next big Thing](https://www.youtube.com/watch?v=tcyb1lpEHm0). He states "Concepts are a waste of time" and proposes a completely different, far more powerful, direction (even in comparison to everything possible in C++ today). Go already has most required features, like reflection and testing if a type implements an optional interface. The only thing missing is code generation. For example, ``json.Marshal`` works fine by using reflection, but if it could also (optionally) generate code by implementing a Go function that gets called by the compiler automatically and runs regular Go code, we would have everything. It might sound crazy at first and toy examples might look verbose, but I think Alexandrescu has a point there. Just think about gqlgen vs. the other reflection based graphql-libs for example. Please watch his talk! - -- [Bodie Solomon](https://github.com/binary132): I find the generics design a bit confusing and opaque. Please consider integrating some concepts from [Zig's beautiful comptime functions](https://news.ycombinator.com/item?id=13761571)! The design of Go 2 generics is clever, but I feel it goes against Go's traditional tight coupling between simple runtime semantics and simple syntax. Additionally, one of the biggest problems of Go, which prevents it from being a viable competitor everywhere I might like to use it, is that I cannot be rid of the GC and runtime. It was my strong hope that Go 2 would introduce compile-time-only generics such that I could reliably avoid the use of dynamic interfaces where I don't want them, without relying on codegen. Unfortunately it looks like that will be decided by the compiler without my input. Please, at least, consider giving users the ability to constrain generics to compile-time-only resolution, perhaps as a property of a Contract, rejecting compilation of dynamic types to satisfy the contract. - -- Dag Sverre Seljebotn: C++ has a huge problem with people abusing metaprogramming ("generics") to do compile-time metaprogramming. I really wished Go had gone down the path of Julia, which offers hygienic macros. Even if it is kept strictly at a compile-time barrier and no run-time code generation, this would at least avoid all the bad tendencies we see in the C++ world that comes from their templating system. Things you can do with generics you can usually pull off with macros too (e.g., `SortSliceOfInts = MakeSliceSorterFunctionMacro!(int)` could generate a new function to sort a slice of integers). Link: https://docs.julialang.org/en/v0.6.1/manual/metaprogramming/ - -- Maxwell Corbin: The issues raised in the Discussion and Open Questions section all could be avoided by defining generics at the package rather than the function or type level. The reason for this is simple: types can reference themselves, but packages can't import themselves, and while there are many ways to algorithmically generate more type signatures, you cannot do the same with import statements. A quick example of such syntax might be: - - ```go - \\ list - package list[T] - - type T interface{} - - type List struct { - Val T - Next *List - } - - // main - package main - - import ( - il "list"[int] - sl "list"[string] - ) - - var iList = il.List{3} - var sList = sl.List{"hello"} - - // etc... - ``` - - The syntax in the example is probably needlessly verbose, but the point is that none of the unfortunate code examples from the blog post are even legal constructions. Package level generics avoids the most abusive problems of meta-programming while retaining the bulk of its usefulness. - -- Andrew Gwozdziewycz: The use of the word `contract` gives me pause due to it overloading "contract" as in [Design by Contract](https://en.wikipedia.org/wiki/Design_by_contract). While the generics use case has some similarities with the "contracts" in DbC if you squint a bit, the concepts are quite different. Since "contracts" are an established concept in Computer Science, I think it would be far less confusing to use a different name like `behavior` or `trait`. The design document also suggests reasons why using `interface` is not ideal, though, Go's contract mechanism seems too obvious an extension of interfaces to disregard so quickly... If it can be done `interface setter(x T) { x.Set(string) error }` and `interface addable(x T, y U) { x + y }` seem quite natural to read and understand. - - - Russell Johnston: Agreed that it would be great to merge contracts and interfaces. Another way around the operator-naming problem might be to provide some standard interfaces for the operators, with bodies inexpressible in normal Go code. For example, a standard `Multipliable` interface would allow the `*` and `*=` operators, while a standard `Comparable` interface would allow `==`, `!=`, `<`, `<=`, `>=`, and `>`. To express operators with multiple types, these interfaces would presumably need type parameters themselves, for example: `type Multipliable(s Self /* this exists implicitly on all interfaces */, t Other) interface { /* provided by the language */ }`. Then user-written interfaces/contracts could use these standard identifier-based names, neatly sidestepping the issues mentioned in the design document around syntax and types. - - Roberto (empijei) Clapis: I agree on this and on the fact that it should be clearer where to use interfaces and where to use contracts. Unifying the two would be great, as they try to address overlapping issues. - - Kurnia D Win: I think `constraint` is better keyword than `contract`. Personally i like `type addable constraint(x T, y U) { x + y }` instead of merging with interface. - -- Hajime Hoshi: I feel like the supposed proposal is too huge to the problems we want to solve listed at https://go.googlesource.com/proposal/+/master/design/go2draft-generics-overview.md . I'm worried this feature would be abused and degrade readability of code. Sorry if I am missing, but the proposal doesn't say anything about `go generate`. Wouldn't `go generate` be enough to the problems? - -- Stephen Rowles: I find the method syntax hard to parse, as a human reading it, it might be clearer to use a different type of enclosing brackets for the type section, e.g. : Me too 👍 +1. Yet another 👍 +1(Pasha Osipyants). - - ``` - func Sum(x []T) T { - var total T - for _, v := range x { - total += v - } - return total - } - ``` - -- yesuu: In this example, think of `T` as the parameter name and `type` as the parameter type. Obviously it is more reasonable to put the `type` behind, and contract is followed by `type`, like `chan int`. - - ```go - func Sum(T type Addable)(x []T) T - ``` - - - Roberto Clapis: Please read [this section](https://go.googlesource.com/proposal/+/master/design/go2draft-contracts.md#why-not-use-like-c_and-java) - - Seems like a bit of a cop-out tbh. It says "in general" which means there must already be exceptions. Go has a nice clear syntax making code simple to read and easy for teams to collaborate. I think it would be worth making the parser more complicated for the sake of making the code readability better. For large scale and long running project readability of the code, and hence maintainability, is king - - What about [this](https://gist.github.com/empijei/a9665ac5e3059671be229acee8826798) - -- Seebs: [Feedback a bit long to inline](https://gist.github.com/seebs/8f943b8b15a8c63c28c7f6f4e5ca6c53), August 2018. Summary basically "I would like a way to specify one contract for each of two types rather than one contract for both types", and "I would prefer `map[T1]T2` to `t1var == t1var` as a canonical form of "T1 must be an allowable map key". - -- Seebs: [What if contracts _were_ just the type-parametric functions?](https://github.com/seebs/notes/blob/master/generics_go2.md). (Sep 1, 2018) - -- Sean Quinlan: I find the contract syntax quite confusing. For something that is supposed to defined exactly what is needed and will be part of the documentation of an api, it can contain all sorts of cruft that does not impact the contract. Moreover, to quote from the design: "We don’t need to explain the meaning of every statement that can appear in a contract body". That seems like the opposite of what I would want from a contract. The fact one can copy the body of a function into a contract and have it work seems like a bug to me, not a feature. Personally, I would much prefer a model that unifies interfaces and contracts. Interfaces feel much closer to what I would like a contract to look like and there is a lot of overlap. It seems probable that many contracts will also be interfaces? - -- Nodir Turakulov: Please elaborate - - > Packages like container/list and container/ring, and types like sync.Map, will be updated to be compile-time type-safe. - - and - - > The math package will be extended to provide a set of simple standard algorithms for all numeric types, such as the ever popular Min and Max functions. - - or ideally add a section about transition/migration of existing types/funcs to use type polymorphism. - FWIU adding type parameter(s) to an existing type/func most likely breaks an existing program that uses the type/func. - How exactly will `math.Max` be changed? - Is the intention to make backward-incompatible changes and write tools to automatically convert code to Go2? - What is the general recommendation for authors of other libraries that provide funcs and types that currently operate with `interface{}`? - Were default values for type parameters considered? e.g. type parameter for `math.Max` would default to `float64` and type parameter for `"container/list".List` would default to `interface{}` - -- Ward Harold: If only for the sake of completeness the [Modula-3](https://www.cs.purdue.edu/homes/hosking/m3/reference/generics.html) generics design should be incorporated into the [Designs in Other Languages](https://go.googlesource.com/proposal/+/master/design/go2draft-generics-overview.md#designs-in-other-languages) section. Modula-3 was a beautiful language that sadly got introduced at the wrong time. - - - Matt Holiday: Ditto mentioning the [Alphard]() language, which was developed about the same time as CLU and also influenced the Ada design. See Alphard: Form and Content, Mary Shaw, ed., Springer 1991 for the various papers collected with some glue material. Alphard & Ada were my introductions to generic programming. Could Go beat C++ for finally delivering contracts after 40 years of waiting? - -- Ole Begemann: You write on the [Generics Overview page](https://go.googlesource.com/proposal/+/master/design/go2draft-generics-overview.md): "Swift added generics in Swift 4, released in 2017." This is not true. Swift has had generics since its first public release in 2014. Evidence (just one example of many): [a transcript of an Apple developer talk on Swift from WWDC 2014](https://asciiwwdc.com/2014/sessions/404) that talks at length about Swift's generics features. - - This is also incorrect: "`Equatable` appears to be a built-in in Swift, not possible to define otherwise." The `Equatable` protocol is defined in the Swift standard library, but there's nothing special about it. It's totally possible to define the same thing in "normal" code. - -- Kevin Gillette: correction for "Contracts" Draft, as of 30 August 2018 - - The one instance of `check.Convert(int, interface{})(0, 0)` should instead be `check.Convert(int, interface{})(0)` or provide an explanation as to why it the function should take two zeros instead of one. - -- [Adam Ierymenko](http://adamierymenko.com): I have an idea for doing limited operator overloading in Go that might make this proposal more useful for numeric code. It's big so [I stuck it in a Gist here](https://gist.github.com/adamierymenko/a03a62da1513a8cc2ac4dfac81b44a9f). - - DeedleFake: I completely agree with the arguments against operator overloading, and I'm quite glad overall that Go doesn't have it, but I also think that the inability to resolve the difference between `a == b` and `a.Equals(b)` via a contract is the biggest problem with the draft design as it currently stands. It means that you'd still wind up writing multiple functions for a fair number of things. Try writing a binary tree, for example. Should you use a contract with `t < t` or `t.Less(t)`? For a sum function, should you use `t + t` or `t.Plus(t)`? I definitely want a solution that doesn't involve operator overloading, though. Maybe there could be a way to specify an adapter that basically says `if a type T, which satisfies contract A but not B, is used for a parameter constrained by contract B, apply this to it in order to get it to satisfy contract B`. Contract B could require a `Plus()` method, for example, while contract A requires the use of `+`, so the adapter automatically attaches a user-specified `Plus()` method to `T` for the duration of its use under that contract. - - Something that might work with this proposal is an `equal(a, b)` builtin that uses `a.Equals(b)` if it exists and `a == b` otherwise, failing to compile if the type is incomparable (and likewise for other operators). It's too weird to seriously consider but it would work with contracts and allow dodging the asymmetry between types that have operators and those that cannot without introducing operator overloading —jimmyfrasche - - Another idea would be explicitly overloadable operators: `a + b` is not overloadable, but `a [+] b` can be overloaded. It will use normal + for primitive types, but will use `Operator+()` etc. for objects if those are present. I really do think that generics without some sane form of operator overloading or something like it are a lot less useful to the point that you might as well not even do it. -Adam Ierymenko (original poster) - - Ian Denhardt: DeedleFake outlines the problems with not having operator overloading well I. I think proposals involving making the overloading "loud" are the wrong idea; instead, we should limit which operators can be overloaded to operators which satisfy these critera: - 1. The operator's semantics can be understood as a method call. Most of the operators on numbers pass this test; `big.Add` is still addition in the sense that we know it from int32, uint64 etc. Examples of operators that fail this test are `&&` and `||`; these are short circuting, which no function or method can replicate. They are fundamentally not methods, no matter how you look at them, and should not be overridable by methods. I think operator overloading gets a bad rap in part because C++ allows you to override _everything_, including crazy stuff like the _comma operator_. - 2. There should be clear use cases for overriding them. Again, arithmetic operators pass this test, along with `<` and friends. Pointer dereferencing passes the first test, but I'm having a hard time coming up with uses for "other types of pointers" that actually seem like a good idea. They are a bit more justifiable in C++, but garbage-collected pointers have basically got you covered. - 3. The normal meaning of the operator should be something that is easy to reason about. For example, pointers are a gnarly source of bugs, and having the possibility that `*foo` is doing something other than reading from a memory address makes an already difficult debugging session that much harder. On the other hand, the possibility that `+` may be a call to `big.Add` is relatively self-contained, and unlikely to cause great confusion. - 4. Finally, the standard library has to set a good example; methods overriding `+` should be conceptually addition, for example. C++ gets off on an utterly wrong foot here by defining what is morally `os.Stdout.ShiftLeft("Hello, World!")`. -- Eltjon Metko: How about specifying the contract after the type identifier inside the function Parameters? This way it can be inferred what T is and we can eliminate the first group of parenthesis. - - ``` - func Sum(x []T:Addable) T { - var total T - for _, v := range x { - total += v - } - return total - } - ``` - -- Tristan Colgate-McFarlane: After going back and forward for a while, I've come down in favour of the proposal largely as is. A limited syntax for contracts might be preferable, but I believe it should allow referencing specific fields (not just methods as some have proposed). If anything can be done to make compatible interface and contracts inter-use easier, that would also be nice (though I think maybe no additional specifications are needed. Lastly, I think it is worth considering deprecating interface types. Whilst drastic, contracts essentially also allow specifying behaviour. Any contract restrictions that limit that (such as refering to other types within the package), should probably be lifted. contracts appear to be a strict superset of interfaces, and I am generally against having two overlapping features. A tool to aide in writing interaces should also be considered. - -- Patrick Smith: We might consider requiring the type keyword when defining methods on generic types. This makes the code a little more verbose, but clearer and more consistent (now type parameters are always preceded by the type keyword). - - ``` - func (x Foo(type T)) Bar() - ``` - -- Patrick Smith: In this example, is `Foo(T)` embedded in `Bar(T)`, or does `Bar(T)` have a method named `Foo`? - - ``` - type Foo(type T) interface {} - type Bar(type T) interface { - Foo(T) - } - ``` - -- Xingtao Zhao: There are too many round brackets in the proposal. In the proposal, it is said that "[]" is ambiguous in some cases. While if we use [type T, S contract], there are no ambiguities any more. - -- Dave Cheney: The earlier Type Functions proposal showed that a type declaration can support a parameter. If this is correct, then the proposed contract declaration could be rewritten from - - ``` - contract stringer(x T) { - var s string = x.String() - } - ``` - - to - - ``` - type stringer(x T) contract { - var s string = x.String() - } - ``` - - This supports Roger’s observation that a contract is a superset of an interface. `type stringer(x T) contract { ... }` introduces a new contract type in the same way `type stringer interface { ... }` introduces a new interface type. - - - jimmyfrasche: A contract is not a type, though. You can't have a value that is a `stringer`. You can have a value of a type that is a `stringer`. It's a metatype. A type is a kind of predicate on values. You ask the compiler "is this value a `string`" and it answers yes (allowing compilation to continue) or no (stopping to tell you what went wrong). A contract is a predicate on a vector of types. You ask the compiler two questions. Do these types satisfy this contract? Then: do these values satisfy these types? Interfaces kind of blur these lines by storing a `(type, value)` pair, provided that the type has the appropriate methods. It's simultaneously a type and a metatype. Any generics system that does not use interfaces as the metatypes will unavoidably contain a superset of interfaces. While it is entirely possible to define a generics system that exclusively uses interfaces as the metatypes, that does mean losing the ability to write generic functions that use things that interfaces can't talk about, like operators. You have to limit the questions you can ask about the types to their method sets. (I'm fine with this). - -- btj: Two very important entries are missing in the draft design document's Designs in Other Languages section: Haskell, with its typeclasses, and Scala, with its implicit arguments. - -- iamgoroot: Wouldn't it be natural to make better type aliasing support and let user have generics as option? And you dont need much syntax for that - -``` -type Key _ -type Value _ - -type IntStringHolder Holder - -type Holder struct { - K Key - V Value -} - -func (h *Holder) Set(k Key, v Value) { - h.K = k - h.V = v -} - -func main() { - v:= IntStringHolder{} - v.Set(7,"Lucky") -} -``` - -- antoniomo: While the draft clearly explains why `F`, `F[T]` and non-ASCII (unable to type it here) `F<>` where discarded, feels like `F{T}` would be more human readable than the sometimes three in a row set of `()`, while not complicating the parser with unbounded lookahead as you can't open a block in those circumstances. - -- aprice2704: I really dislike the idea of using regular parentheses `(`, would a two-character sequence cause compiler overhead from unbounded lookahead? How about <| and |> ? would they work? They have the advantages of being quite distinct from `(`, making some visual sense in ascii, and in the 'Fira Code' font (highly recommended) which I use in VSCode there are ligatures to render these as little right or left pointing triangles. - -- leaxoy: First I'm sorry for editing the page footer, however I can't remove footer content. This is my opinion: lots of `(` & `)` made go looks so messy, `<` & `>` like other language is better, and is more kindly for those come from other languages. - -- Hajime Hoshi: I completely agree on aprice2704's syntax concern. Wouldn't `[[` / `]]` work, for example? \ No newline at end of file diff --git a/GoArm.md b/GoArm.md index 4c4c2b78..a864c53e 100644 --- a/GoArm.md +++ b/GoArm.md @@ -1,1595 +1,4 @@ -# Introduction +The Go wiki on GitHub has moved to go.dev (#61940). -Go is fully supported on Linux and Darwin. Any Go program that you can compile for x86/x86\_64 should work on Arm. Besides Linux and Darwin, Go is also experimentally supported on FreeBSD, OpenBSD and NetBSD. +Try or . -# Supported architectures - -Go supports the following ARM architectural families. - -| **Architecture** | **Status** | **GOARM value** | **GOARCH value** | -|:-----------------|:-----------|:----------------|:-----------------| -| ARMv4 and below | not supported | n/a | n/a | -| ARMv5 | supported | GOARM=5 | GOARCH=arm | -| ARMv6 | supported | GOARM=6 | GOARCH=arm | -| ARMv7 | supported | GOARM=7 | GOARCH=arm | -| ARMv8 | supported | n/a | GOARCH=arm64 | - -Starting from Go 1.1, the appropriate GOARM value will be chosen if you compile the program from source on the target machine. In cross compilation situations, it is recommended that you always set an appropriate GOARM value along with GOARCH. - -# Supported operating systems - -* ARM on Linux. You must run an [EABI](http://wiki.debian.org/ArmEabiPort) kernel. These are generally known as `armel` for softfloat (compatible with ARMv5) or `armhf` for hardware floating point (ARMv6 and above). -* ARM on Darwin: ARMv7 is required. -* ARM on FreeBSD, OpenBSD, and NetBSD: ARMv6K or above is required. - -# Recommended Go version - -Go has a mature support for ARM systems; so, just like for other architectures, use the latest stable version (eg: Go 1.18 at the time of writing). - -# Tips and tricks - -## /tmp and tmpfs -The ` go ` build tool uses ` /tmp ` when compiling and testing, this can cause heavy wear and tear if ` /tmp ` lives on your SD card. To minimise this effect, either ` export TMPDIR ` to somewhere that lives on another filesystem. Alternatively if you have lots of physical memory you can mount a swap backed tmpfs filesystem on /tmp by adding this line to ` /etc/fstab ` - -``` -tmpfs /tmp tmpfs nodev,nosuid,mode=1777 0 0 -``` - -## Swap -Building Go from source requires at least 256mb of RAM. Running the tests requires at least 256mb of memory and at least 512mb of swap space. - -## Test failures due to resource starvation -The runtime tests create many native operating system threads which at the default of 8mb per thread can exhaust an ARM system with 32bit user mode address space (especially on multicore ARM systems such as the Raspberry PI 2). To prevent the runtime test from failing you may need lower the thread stack limit: - -```sh -% ulimit -s 1024 # set the thread stack limit to 1mb -% ulimit -s # check that it worked -1024 -``` -See [Dave Cheney's blog post about building Go on Raspberry Pi](http://dave.cheney.net/2015/09/04/building-go-1-5-on-the-raspberry-pi) for details. - -## Build failures due to lack of memory -The Go tool will try to keep all your cpu cores busy when installing packages (during make.bash), -this is normally preferable on PCs where memory is abundant. -However, some powerful multicore ARM machines don't have enough memory to support parallel -builds utilizing all available cores, and you can work around that by using the ` taskset(1) ` utility -to limit Go to only use one core without resorting to swaps. -``` -taskset 1 ./make.bash # use 3 if you want to use two cores -``` -Note: the 1 here is a bitmask for cpu affinity and it's not the number of cpu cores you're -willing to use, please refer to ` taskset(1) ` manual for details. - -# Known issues - -## Lack of floating point hardware on ARMv5 -The major issue with ARMv5 is the lack of floating point support in common ARMv5 hardware. When compiled with the GOARM=5 environment variable, the 5l linker will insert a call to ` _sfloat ` before any block of floating point instructions to branch into the floating point emulator. This means that binaries produced with a Go installation that was compiled with soft float support will work on all supported architectures, but builds compiled without soft floating point support will not work on ARMv5. - - This isn't strictly true, there exist ARMv5 implementations which have VFP1 floating point. However the compiler doesn't support VFP1 yet. - -## html/template and test/nilptr.go test fail on HTC Android -html/template test and test/nilptr.go is known to fail on HTC's Android kernels ([ref](http://www.mail-archive.com/android-developers@googlegroups.com/msg153389.html)), because the kernel will kill the application after 10 segfaults. - -## Potential kernel bug in 2.6.32-5-kirkwood on QNAP 219P -See [Issue 5466](https://github.com/golang/go/issues/5466) for details. Updating to 3.2.0-4-kirkwood solved the issue. - -# Success stories - -ARM hardware comes in a myriad of shapes and sizes. If you've had a success story building and running Go on your Arm system, please detail your results here. - -## Netgear Stora - -Architecture: ARMv5 - -Operating System: Debian Sid - -The Netgear Stora is an ARMv5 (Marvell Kirkwood) platform. I flashed mine with a Debian Sid distribution and it was, until Go1, a solid platform for Go development. The main drawback is the Stora only has 128mb of ram, which is not quite enough to run ./all.bash as 5l can use more than 100mb of ram when linking some commands. - -Instructions for installing Debian on your Stora can be found on the OpenStora website, http://www.openstora.com/wiki/index.php?title=How_to_install_Debian_Linux_on_NETGEAR_Stora. - -> _-- dave cheney_ - -## Qnap TS-119P II - -Architecture: ARMv5 - -Operating System: Debian Squeeze - -The Qnap TS series of NASs are excellent hackable little linux hosts. The TS-11P9 II is a 2Ghz Marvell Kirkwood ARMv5 processor with 512mb of ram and a single SATA drive bay. - -The kirkwood platform is supported by the native debian installer. http://www.cyrius.com/debian/kirkwood/qnap/ts-119/install.html - -> _-- dave cheney_ - -## Pandaboard - -Architecture: ARMv7 - -Operating System: Ubuntu 12.04LTS (armhf) - -The Pandaboard is a dual core ARMv7 development board based on the Texas Instruments OMAP4 SoC platform. I run ubuntu 12.04 LTS server on mine, which is an excellent distribution for Arm development. The Pandaboard has a gig of ram which makes it excellent for development and benchmarking. - -Instructions and SD card image can be found on on the Ubuntu wiki, https://wiki.ubuntu.com/ARM/Server/Install#Installing_pre-installed_OMAP4_Precise_.2812.04.29_Server_Images. - -> _-- dave cheney_ - -## BeagleBone - -Architecture: ARMv7 single core, Cortex-A8, 256MB RAM, 720 MHz - -Operating System: Angstrom Linux - -BeagleBone is similar to Beagleboard, but without the video components. Angstrom is a very small Linux distribution for ARM based systems. It is built on top of Yocto and OpenEmbedded with additional tools and recipes to make it even easier to build a distribution. You can think of Angstrom as Ubuntu and OpenEmbedded/Yocto as Debian. Angstrom is very light weight and fast compared to Ubuntu. It uses systemd instead of the sys5 scripts which help give you a very fast boot time of a few seconds. - -BeagleBone is probably faster than a RasberryPI because of it's newer Cortex-A8 dual-issue superscalar architecture, but the PI has the GPU which theoretically could be used with something like OpenCL to really run circles around the BeagleBone. However, for embedded applications the BeagleBone is easier to work with because it is ready out of the box with GPIO connections. - -I've cross compiled for ARM with 5g from a Mac and so far I haven't run into any problems. You can build on the BeagleBone, but cross compiling with Go is so easy that it is better to save wear and tear on the flash drive and just compile somewhere else. - -> _-- hans stimer_ - -### Zyxel NSA 310 - -Architecture: ARM5 -Platform: Debian Wheeze - -Successfuly built default branch, going to write fan control daemon for this device in golang. - -### Raspberry Pi - -* [Building Go 1.5 on the Raspberry Pi - Dave Cheney](http://dave.cheney.net/2015/09/04/building-go-1-5-on-the-raspberry-pi) - -Architecture: ARM1176JZFS, with floating point, running at 700Mhz - -Operating System: Debian Wheezy beta distribution (http://www.raspberrypi.org/archives/1435) reported as: - -` Linux raspberrypi 3.1.9+ #125 PREEMPT Sun Jun 17 16:09:36 BST 2012 armv6l GNU/Linux ` - -**Memory Split**: the Pi shares its 256mb of memory between the CPU and the GPU. You should allocate as much memory as possible to the CPU for a successful compilation. The configuration for the memory split is stored on your SD card. This link has a script to adjust the configuration, http://sirlagz.net/?p=445. - -Go version weekly.2012-03-27 +645947213cac, with timeout and GOARM 7 patches http://codereview.appspot.com/5987063/) builds with 2 test failures: encoding/gob fails with out of memory, and fmt fails the NaN test. - -Successfully installed and run SVGo via go get github.com/ajstarks/svgo, tested with goplay: - -![http://farm8.staticflickr.com/7139/7451061716_fbb585c55f.jpg](http://farm8.staticflickr.com/7139/7451061716_fbb585c55f.jpg) - -Division benchmark via http://codereview.appspot.com/6258067: - - -``` -$ cd $GOROOT/src/pkg/runtime -$ go test -test.bench=BenchmarkUint - - -BenchmarkUint32Div7 5000000 547 ns/op -BenchmarkUint32Div37 5000000 547 ns/op -BenchmarkUint32Div123 5000000 547 ns/op -BenchmarkUint32Div763 5000000 547 ns/op -BenchmarkUint32Div1247 5000000 547 ns/op -BenchmarkUint32Div9305 5000000 547 ns/op -BenchmarkUint32Div13307 5000000 547 ns/op -BenchmarkUint32Div52513 5000000 547 ns/op -BenchmarkUint32Div60978747 5000000 547 ns/op -BenchmarkUint32Div106956295 5000000 547 ns/op -BenchmarkUint32Mod7 5000000 547 ns/op -BenchmarkUint32Mod37 5000000 547 ns/op -BenchmarkUint32Mod123 5000000 547 ns/op -BenchmarkUint32Mod763 5000000 547 ns/op -BenchmarkUint32Mod1247 5000000 547 ns/op -BenchmarkUint32Mod9305 5000000 547 ns/op -BenchmarkUint32Mod13307 5000000 547 ns/op -BenchmarkUint32Mod52513 5000000 547 ns/op -BenchmarkUint32Mod60978747 5000000 547 ns/op -BenchmarkUint32Mod106956295 5000000 547 ns/op -``` - -Running the hardware floating point distribution, Raspbian "pisces" (http://www.raspbian.org/PiscesImages) and applying the patches in https://gist.github.com/3116118, here are the results of the Eleanor McHugh gospeed benchmark: - -``` -raspbian@pisces:~/gowork/src/github.com/feyeleanor/gospeed$ uname -a -Linux pisces 3.1.9+ #171 PREEMPT Tue Jul 17 01:08:22 BST 2012 armv6l GNU/Linux -raspbian@pisces:~/gowork/src/github.com/feyeleanor/gospeed$ go test -test.bench=".*" -PASS -BenchmarkBaselineCastInt32ToInt 100000000 13.5 ns/op -BenchmarkBaselineCastIntToInt32 100000000 13.5 ns/op -BenchmarkBaselineCastInt64ToUint64 100000000 17.8 ns/op -BenchmarkBaselineCastUint64ToInt64 100000000 17.2 ns/op -BenchmarkBaselineVariableGet 100000000 13.4 ns/op -BenchmarkBaselineVariableSet 100000000 22.4 ns/op -BenchmarkBaselineVariableGetInterface 100000000 13.5 ns/op -BenchmarkBaselineVariableSetInterface 50000000 31.3 ns/op -BenchmarkBaselineVariableIncrement 100000000 23.9 ns/op -BenchmarkBaselineVariableDecrement 100000000 23.9 ns/op -BenchmarkBaselineFieldGet 100000000 13.5 ns/op -BenchmarkBaselineFieldSet 100000000 20.9 ns/op -BenchmarkBaselineSliceGet 50000000 32.9 ns/op -BenchmarkBaselineSliceSet 50000000 34.5 ns/op -BenchmarkBaselineMapIntGet 1000000 1448 ns/op -BenchmarkBaselineMapIntSet 1000000 1968 ns/op -BenchmarkBaselineMapStringGet 1000000 1119 ns/op -BenchmarkBaselineMapStringSet 1000000 1675 ns/op -BenchmarkBaselineIf 100000000 15.0 ns/op -BenchmarkBaselineIfElse 100000000 15.0 ns/op -BenchmarkBaselineSwitchDefault 100000000 13.5 ns/op -BenchmarkBaselineSwitchOneCase 100000000 15.0 ns/op -BenchmarkBaselineSwitchTwoCases 100000000 18.0 ns/op -BenchmarkBaselineSwitchTwoCasesFallthrough 100000000 18.0 ns/op -BenchmarkBaselineForLoopIteration 50000000 42.0 ns/op -BenchmarkBaselineForReverseLoopIteration 50000000 36.0 ns/op -BenchmarkBaselineForRange 20000000 80.9 ns/op -BenchmarkBaselineForSliceLength 50000000 39.0 ns/op -BenchmarkBaselineForReverseSliceLength 50000000 36.0 ns/op -BenchmarkBaselineForLoopIteration10 20000000 119 ns/op -BenchmarkBaselineForReverseLoopIteration10 20000000 92.9 ns/op -BenchmarkBaselineForRange10 10000000 215 ns/op -BenchmarkBaselineForSliceLength10 20000000 109 ns/op -BenchmarkBaselineForReverseSliceLength10 20000000 92.9 ns/op -BenchmarkBaselineForLoopIteration100 2000000 929 ns/op -BenchmarkBaselineForReverseLoopIteration100 5000000 700 ns/op -BenchmarkBaselineForRange100 1000000 1567 ns/op -BenchmarkBaselineForSliceLength100 2000000 853 ns/op -BenchmarkBaselineForReverseSliceLength100 5000000 700 ns/op -BenchmarkBaselineForLoopIteration10000 10000 106006 ns/op -BenchmarkBaselineForReverseLoopIteration10000 50000 67480 ns/op -BenchmarkBaselineForRange10000 10000 153841 ns/op -BenchmarkBaselineForSliceLength10000 20000 85735 ns/op -BenchmarkBaselineForReverseSliceLength10000 50000 69461 ns/op -BenchmarkBaselineMakeChannelBoolUnbuffered 200000 10162 ns/op -BenchmarkBaselineMakeChannelBool1 200000 12517 ns/op -BenchmarkBaselineMakeChannelBool10 200000 12521 ns/op -BenchmarkBaselineMakeChannelStringUnbuffered 500000 10369 ns/op -BenchmarkBaselineMakeChannelString1 200000 12576 ns/op -BenchmarkBaselineMakeChannelString10 100000 22358 ns/op -BenchmarkBaselineGo 50000 367593 ns/op -BenchmarkBaselineFunctionCall 50000000 57.0 ns/op -BenchmarkBaselineFunctionCallArg 20000000 81.0 ns/op -BenchmarkBaselineFunctionCall5VarArgs 500000 6852 ns/op -BenchmarkBaselineFunctionCallInt 50000000 60.3 ns/op -BenchmarkBaselineFunctionCall5VarInts 1000000 3185 ns/op -BenchmarkBaselineFunctionCallWithDefer 1000000 2330 ns/op -BenchmarkBaselineFunctionCallPanicRecover 500000 6222 ns/op -BenchmarkBaselineMethodCallDirect 20000000 83.8 ns/op -BenchmarkBaselineMethodCallDirect1Arg 20000000 106 ns/op -BenchmarkBaselineMethodCallDirect1Int 20000000 85.2 ns/op -BenchmarkBaselineMethodCallDirect5Args 5000000 368 ns/op -BenchmarkBaselineMethodCallDirect5Ints 10000000 233 ns/op -BenchmarkBaselineMethodCallIndirect 100000000 18.0 ns/op -BenchmarkBaselineMethodCallIndirect1Arg 50000000 42.0 ns/op -BenchmarkBaselineMethodCallIndirect1Int 100000000 19.5 ns/op -BenchmarkBaselineMethodCallIndirect5Args 5000000 309 ns/op -BenchmarkBaselineMethodCallIndirect5Ints 10000000 168 ns/op -BenchmarkBaselineTypeAssertion 10000000 218 ns/op -BenchmarkBaselineTypeAssertionEmptyInterface 20000000 106 ns/op -BenchmarkBaselineTypeAssertionInterface1 5000000 576 ns/op -BenchmarkBaselineTypeAssertionInterface2 5000000 579 ns/op -BenchmarkBaselineTypeReflectPrimitiveToValue 5000000 425 ns/op -BenchmarkBaselineTypeReflectSliceToValue 1000000 3218 ns/op -BenchmarkBaselineTypeReflectStructToValue 500000 4760 ns/op -BenchmarkBaselineTypeCheck 10000000 189 ns/op -BenchmarkBaselineTypeCheckEmptyInterface 20000000 93.1 ns/op -BenchmarkBaselineTypeCheckInterface1 5000000 511 ns/op -BenchmarkBaselineTypeCheckInterface2 5000000 516 ns/op -BenchmarkBaselineTypeSwitchOneCase 10000000 262 ns/op -BenchmarkBaselineTypeSwitchBasicTypesCase 10000000 295 ns/op -BenchmarkBaselineTypeSwitchEmptyInterface 10000000 163 ns/op -BenchmarkBaselineTypeSwitchInterface1 5000000 588 ns/op -BenchmarkBaselineTypeSwitchInterface2 5000000 602 ns/op -BenchmarkBaselineNewStructureLiteral 20000000 84.0 ns/op -BenchmarkBaselineNewStructure 20000000 127 ns/op -BenchmarkBaselineNewSliceLiteral 50000000 54.2 ns/op -BenchmarkBaselineNewSlice 1000000 3124 ns/op -BenchmarkBaselineNewMapLiteralIntToInt 500000 9083 ns/op -BenchmarkBaselineNewMapLiteralIntToInterface 500000 9807 ns/op -BenchmarkBaselineNewMapLiteralStringToInt 500000 9792 ns/op -BenchmarkBaselineNewMapLiteralStringToInterface 500000 10595 ns/op -BenchmarkBaselineNewMapLiteralIntToInt2Item 200000 14265 ns/op -BenchmarkBaselineNewMapLiteralIntToInterface2Item 200000 14669 ns/op -BenchmarkBaselineNewMapLiteralStringToInt2Item 200000 14025 ns/op -BenchmarkBaselineNewMapLiteralStringToInterface2Item 200000 15086 ns/op -BenchmarkBaselineNewMapIntToInt 500000 9025 ns/op -BenchmarkBaselineNewMapIntToInterface 500000 9753 ns/op -BenchmarkBaselineNewMapStringToInt 500000 9740 ns/op -BenchmarkBaselineNewMapStringToInterface 500000 10486 ns/op -BenchmarkBaselineSliceCopy 5000000 300 ns/op -BenchmarkBaselineNewSliceAppendElement1 1000000 3318 ns/op -BenchmarkBaselineNewSliceAppendElement10 1000000 5174 ns/op -ok github.com/feyeleanor/gospeed 417.296s -``` - -_-- anthony starks_ - - -## Raspberry Pi 2 - -* [Building Go 1.5 on the Raspberry Pi - Dave Cheney](http://dave.cheney.net/2015/09/04/building-go-1-5-on-the-raspberry-pi) - -``` -go version -go version devel +07f9c25 Wed Dec 9 21:25:05 2015 +0000 linux/arm - -$ go test -timeout 20m -v -bench=Benchmark -run=X -PASS -BenchmarkAppend-4 3000000 402 ns/op -BenchmarkAppendGrowByte-4 50 27296836 ns/op -BenchmarkAppendGrowString-4 1 1277592542 ns/op -BenchmarkAppend1Byte-4 20000000 75.6 ns/op -BenchmarkAppend4Bytes-4 20000000 88.2 ns/op -BenchmarkAppend7Bytes-4 20000000 103 ns/op -BenchmarkAppend8Bytes-4 20000000 89.1 ns/op -BenchmarkAppend15Bytes-4 20000000 109 ns/op -BenchmarkAppend16Bytes-4 20000000 94.5 ns/op -BenchmarkAppend32Bytes-4 20000000 91.4 ns/op -BenchmarkAppendStr1Byte-4 20000000 73.9 ns/op -BenchmarkAppendStr4Bytes-4 20000000 84.7 ns/op -BenchmarkAppendStr8Bytes-4 20000000 88.7 ns/op -BenchmarkAppendStr16Bytes-4 20000000 94.5 ns/op -BenchmarkAppendStr32Bytes-4 20000000 91.3 ns/op -BenchmarkAppendSpecialCase-4 2000000 675 ns/op -BenchmarkCopy1Byte-4 20000000 109 ns/op 9.13 MB/s -BenchmarkCopy2Byte-4 20000000 112 ns/op 17.77 MB/s -BenchmarkCopy4Byte-4 10000000 120 ns/op 33.26 MB/s -BenchmarkCopy8Byte-4 10000000 122 ns/op 65.32 MB/s -BenchmarkCopy12Byte-4 10000000 126 ns/op 94.82 MB/s -BenchmarkCopy16Byte-4 10000000 129 ns/op 123.60 MB/s -BenchmarkCopy32Byte-4 10000000 126 ns/op 252.60 MB/s -BenchmarkCopy128Byte-4 10000000 162 ns/op 786.76 MB/s -BenchmarkCopy1024Byte-4 3000000 479 ns/op 2134.17 MB/s -BenchmarkCopy1String-4 20000000 100 ns/op 9.98 MB/s -BenchmarkCopy2String-4 20000000 104 ns/op 19.19 MB/s -BenchmarkCopy4String-4 20000000 111 ns/op 35.86 MB/s -BenchmarkCopy8String-4 20000000 114 ns/op 70.02 MB/s -BenchmarkCopy12String-4 20000000 116 ns/op 103.17 MB/s -BenchmarkCopy16String-4 10000000 120 ns/op 132.69 MB/s -BenchmarkCopy32String-4 20000000 116 ns/op 273.77 MB/s -BenchmarkCopy128String-4 10000000 150 ns/op 851.31 MB/s -BenchmarkCopy1024String-4 3000000 472 ns/op 2167.03 MB/s -BenchmarkChanNonblocking-4 20000000 77.7 ns/op -BenchmarkSelectUncontended-4 2000000 780 ns/op -BenchmarkSelectSyncContended-4 100000 15094 ns/op -BenchmarkSelectAsyncContended-4 500000 2569 ns/op -BenchmarkSelectNonblock-4 10000000 226 ns/op -BenchmarkChanUncontended-4 50000 26993 ns/op -BenchmarkChanContended-4 10000 111382 ns/op -BenchmarkChanSync-4 300000 3994 ns/op -BenchmarkChanProdCons0-4 500000 3100 ns/op -BenchmarkChanProdCons10-4 1000000 2099 ns/op -BenchmarkChanProdCons100-4 1000000 1342 ns/op -BenchmarkChanProdConsWork0-4 500000 3071 ns/op -BenchmarkChanProdConsWork10-4 500000 2332 ns/op -BenchmarkChanProdConsWork100-4 1000000 1382 ns/op -BenchmarkSelectProdCons-4 300000 5015 ns/op -BenchmarkChanCreation-4 2000000 629 ns/op -BenchmarkChanSem-4 1000000 1116 ns/op -BenchmarkChanPopular-4 200 7597153 ns/op -BenchmarkCallClosure-4 30000000 43.5 ns/op -BenchmarkCallClosure1-4 30000000 49.0 ns/op -BenchmarkCallClosure2-4 5000000 323 ns/op -BenchmarkCallClosure3-4 5000000 318 ns/op -BenchmarkCallClosure4-4 5000000 324 ns/op -BenchmarkComplex128DivNormal-4 3000000 488 ns/op -BenchmarkComplex128DivNisNaN-4 5000000 375 ns/op -BenchmarkComplex128DivDisNaN-4 5000000 362 ns/op -BenchmarkComplex128DivNisInf-4 5000000 289 ns/op -BenchmarkComplex128DivDisInf-4 5000000 273 ns/op -BenchmarkSetTypePtr-4 20000000 85.1 ns/op 46.98 MB/s -BenchmarkSetTypePtr8-4 10000000 169 ns/op 189.14 MB/s -BenchmarkSetTypePtr16-4 10000000 213 ns/op 299.83 MB/s -BenchmarkSetTypePtr32-4 5000000 297 ns/op 429.62 MB/s -BenchmarkSetTypePtr64-4 3000000 462 ns/op 553.72 MB/s -BenchmarkSetTypePtr126-4 2000000 791 ns/op 636.59 MB/s -BenchmarkSetTypePtr128-4 2000000 777 ns/op 658.60 MB/s -BenchmarkSetTypePtrSlice-4 200000 6208 ns/op 659.75 MB/s -BenchmarkSetTypeNode1-4 10000000 160 ns/op 74.86 MB/s -BenchmarkSetTypeNode1Slice-4 1000000 1076 ns/op 356.60 MB/s -BenchmarkSetTypeNode8-4 10000000 221 ns/op 180.94 MB/s -BenchmarkSetTypeNode8Slice-4 1000000 2359 ns/op 542.53 MB/s -BenchmarkSetTypeNode64-4 3000000 506 ns/op 521.63 MB/s -BenchmarkSetTypeNode64Slice-4 100000 12992 ns/op 650.22 MB/s -BenchmarkSetTypeNode64Dead-4 5000000 308 ns/op 856.90 MB/s -BenchmarkSetTypeNode64DeadSlice-4 200000 11506 ns/op 734.21 MB/s -BenchmarkSetTypeNode124-4 2000000 799 ns/op 630.27 MB/s -BenchmarkSetTypeNode124Slice-4 100000 23306 ns/op 692.00 MB/s -BenchmarkSetTypeNode126-4 2000000 776 ns/op 659.33 MB/s -BenchmarkSetTypeNode126Slice-4 100000 21520 ns/op 761.31 MB/s -BenchmarkSetTypeNode128-4 2000000 850 ns/op 611.35 MB/s -BenchmarkSetTypeNode128Slice-4 50000 24122 ns/op 689.81 MB/s -BenchmarkSetTypeNode130-4 2000000 827 ns/op 638.06 MB/s -BenchmarkSetTypeNode130Slice-4 50000 24322 ns/op 694.67 MB/s -BenchmarkSetTypeNode1024-4 300000 5655 ns/op 725.66 MB/s -BenchmarkSetTypeNode1024Slice-4 10000 183602 ns/op 715.28 MB/s -BenchmarkAllocation-4 10000 166825 ns/op -BenchmarkHash5-4 10000000 217 ns/op 23.02 MB/s -BenchmarkHash16-4 5000000 289 ns/op 55.18 MB/s -BenchmarkHash64-4 2000000 770 ns/op 83.10 MB/s -BenchmarkHash1024-4 200000 9442 ns/op 108.44 MB/s -BenchmarkHash65536-4 2000 600452 ns/op 109.14 MB/s -BenchmarkEqEfaceConcrete-4 20000000 79.1 ns/op -BenchmarkEqIfaceConcrete-4 20000000 77.0 ns/op -BenchmarkNeEfaceConcrete-4 20000000 80.0 ns/op -BenchmarkNeIfaceConcrete-4 20000000 77.7 ns/op -BenchmarkConvT2ESmall-4 5000000 362 ns/op -BenchmarkConvT2EUintptr-4 5000000 394 ns/op -BenchmarkConvT2ELarge-4 3000000 457 ns/op -BenchmarkConvT2ISmall-4 3000000 482 ns/op -BenchmarkConvT2IUintptr-4 3000000 524 ns/op -BenchmarkConvT2ILarge-4 3000000 600 ns/op -BenchmarkConvI2E-4 20000000 60.5 ns/op -BenchmarkConvI2I-4 5000000 302 ns/op -BenchmarkAssertE2T-4 10000000 121 ns/op -BenchmarkAssertE2TLarge-4 10000000 131 ns/op -BenchmarkAssertE2I-4 5000000 329 ns/op -BenchmarkAssertI2T-4 10000000 125 ns/op -BenchmarkAssertI2I-4 5000000 328 ns/op -BenchmarkAssertI2E-4 20000000 84.6 ns/op -BenchmarkAssertE2E-4 50000000 32.5 ns/op -BenchmarkAssertE2T2-4 10000000 129 ns/op -BenchmarkAssertE2T2Blank-4 100000000 18.0 ns/op -BenchmarkAssertI2E2-4 20000000 91.2 ns/op -BenchmarkAssertI2E2Blank-4 100000000 16.7 ns/op -BenchmarkAssertE2E2-4 10000000 159 ns/op -BenchmarkAssertE2E2Blank-4 100000000 16.8 ns/op -BenchmarkMalloc8-4 5000000 317 ns/op -BenchmarkMalloc16-4 3000000 485 ns/op -BenchmarkMallocTypeInfo8-4 3000000 587 ns/op -BenchmarkMallocTypeInfo16-4 2000000 661 ns/op -BenchmarkMallocLargeStruct-4 500000 3205 ns/op -BenchmarkGoroutineSelect-4 100 18605318 ns/op -BenchmarkGoroutineBlocking-4 100 17222169 ns/op -BenchmarkGoroutineForRange-4 100 19092854 ns/op -BenchmarkGoroutineIdle-4 100 12554944 ns/op -BenchmarkMapPop100-4 5000 270721 ns/op -BenchmarkMapPop1000-4 300 4674884 ns/op -BenchmarkMapPop10000-4 10 110070793 ns/op -BenchmarkHashStringSpeed-4 3000000 400 ns/op -BenchmarkHashBytesSpeed-4 2000000 709 ns/op -BenchmarkHashInt32Speed-4 5000000 305 ns/op -BenchmarkHashInt64Speed-4 5000000 349 ns/op -BenchmarkHashStringArraySpeed-4 2000000 911 ns/op -BenchmarkMegMap-4 5000000 367 ns/op -BenchmarkMegOneMap-4 5000000 311 ns/op -BenchmarkMegEqMap-4 100 10147332 ns/op -BenchmarkMegEmptyMap-4 10000000 138 ns/op -BenchmarkSmallStrMap-4 5000000 367 ns/op -BenchmarkMapStringKeysEight_16-4 5000000 395 ns/op -BenchmarkMapStringKeysEight_32-4 5000000 378 ns/op -BenchmarkMapStringKeysEight_64-4 5000000 378 ns/op -BenchmarkMapStringKeysEight_1M-4 5000000 376 ns/op -BenchmarkIntMap-4 10000000 198 ns/op -BenchmarkRepeatedLookupStrMapKey32-4 2000000 799 ns/op -BenchmarkRepeatedLookupStrMapKey1M-4 100 10023558 ns/op -BenchmarkNewEmptyMap-4 2000000 841 ns/op 0 B/op 0 allocs/op -BenchmarkNewSmallMap-4 1000000 2357 ns/op 0 B/op 0 allocs/op -BenchmarkMapIter-4 1000000 2132 ns/op -BenchmarkMapIterEmpty-4 20000000 107 ns/op -BenchmarkSameLengthMap-4 20000000 111 ns/op -BenchmarkBigKeyMap-4 2000000 727 ns/op -BenchmarkBigValMap-4 2000000 754 ns/op -BenchmarkSmallKeyMap-4 5000000 296 ns/op -BenchmarkComplexAlgMap-4 1000000 1786 ns/op -BenchmarkMemmove0-4 30000000 47.7 ns/op -BenchmarkMemmove1-4 30000000 50.2 ns/op 19.93 MB/s -BenchmarkMemmove2-4 30000000 53.7 ns/op 37.28 MB/s -BenchmarkMemmove3-4 30000000 56.9 ns/op 52.76 MB/s -BenchmarkMemmove4-4 20000000 61.1 ns/op 65.42 MB/s -BenchmarkMemmove5-4 20000000 75.8 ns/op 65.95 MB/s -BenchmarkMemmove6-4 20000000 79.2 ns/op 75.80 MB/s -BenchmarkMemmove7-4 20000000 82.5 ns/op 84.84 MB/s -BenchmarkMemmove8-4 20000000 64.8 ns/op 123.37 MB/s -BenchmarkMemmove9-4 20000000 67.1 ns/op 134.16 MB/s -BenchmarkMemmove10-4 20000000 76.4 ns/op 130.87 MB/s -BenchmarkMemmove11-4 20000000 81.3 ns/op 135.30 MB/s -BenchmarkMemmove12-4 20000000 66.8 ns/op 179.68 MB/s -BenchmarkMemmove13-4 20000000 70.6 ns/op 184.23 MB/s -BenchmarkMemmove14-4 20000000 75.2 ns/op 186.19 MB/s -BenchmarkMemmove15-4 20000000 79.5 ns/op 188.74 MB/s -BenchmarkMemmove16-4 20000000 71.8 ns/op 222.73 MB/s -BenchmarkMemmove32-4 20000000 68.3 ns/op 468.52 MB/s -BenchmarkMemmove64-4 20000000 79.2 ns/op 808.35 MB/s -BenchmarkMemmove128-4 20000000 101 ns/op 1256.13 MB/s -BenchmarkMemmove256-4 10000000 145 ns/op 1755.64 MB/s -BenchmarkMemmove512-4 5000000 244 ns/op 2095.34 MB/s -BenchmarkMemmove1024-4 3000000 475 ns/op 2153.54 MB/s -BenchmarkMemmove2048-4 2000000 883 ns/op 2317.95 MB/s -BenchmarkMemmove4096-4 1000000 1809 ns/op 2262.99 MB/s -BenchmarkMemmoveUnaligned0-4 30000000 58.1 ns/op -BenchmarkMemmoveUnaligned1-4 20000000 63.3 ns/op 15.81 MB/s -BenchmarkMemmoveUnaligned2-4 20000000 66.6 ns/op 30.04 MB/s -BenchmarkMemmoveUnaligned3-4 20000000 69.9 ns/op 42.89 MB/s -BenchmarkMemmoveUnaligned4-4 20000000 95.6 ns/op 41.85 MB/s -BenchmarkMemmoveUnaligned5-4 20000000 98.6 ns/op 50.73 MB/s -BenchmarkMemmoveUnaligned6-4 20000000 99.9 ns/op 60.08 MB/s -BenchmarkMemmoveUnaligned7-4 20000000 101 ns/op 68.77 MB/s -BenchmarkMemmoveUnaligned8-4 20000000 108 ns/op 73.58 MB/s -BenchmarkMemmoveUnaligned9-4 20000000 112 ns/op 79.90 MB/s -BenchmarkMemmoveUnaligned10-4 10000000 126 ns/op 79.18 MB/s -BenchmarkMemmoveUnaligned11-4 10000000 128 ns/op 85.32 MB/s -BenchmarkMemmoveUnaligned12-4 10000000 132 ns/op 90.67 MB/s -BenchmarkMemmoveUnaligned13-4 10000000 125 ns/op 103.51 MB/s -BenchmarkMemmoveUnaligned14-4 10000000 132 ns/op 105.50 MB/s -BenchmarkMemmoveUnaligned15-4 10000000 138 ns/op 108.38 MB/s -BenchmarkMemmoveUnaligned16-4 10000000 141 ns/op 112.89 MB/s -BenchmarkMemmoveUnaligned32-4 10000000 154 ns/op 207.69 MB/s -BenchmarkMemmoveUnaligned64-4 10000000 211 ns/op 303.20 MB/s -BenchmarkMemmoveUnaligned128-4 5000000 318 ns/op 401.47 MB/s -BenchmarkMemmoveUnaligned256-4 3000000 436 ns/op 586.76 MB/s -BenchmarkMemmoveUnaligned512-4 2000000 722 ns/op 708.50 MB/s -BenchmarkMemmoveUnaligned1024-4 1000000 1296 ns/op 789.56 MB/s -BenchmarkMemmoveUnaligned2048-4 500000 2576 ns/op 794.83 MB/s -BenchmarkMemmoveUnaligned4096-4 300000 4999 ns/op 819.32 MB/s -BenchmarkMemclr5-4 20000000 77.1 ns/op 64.82 MB/s -BenchmarkMemclr16-4 20000000 96.3 ns/op 166.15 MB/s -BenchmarkMemclr64-4 20000000 85.0 ns/op 753.23 MB/s -BenchmarkMemclr256-4 10000000 125 ns/op 2040.75 MB/s -BenchmarkMemclr4096-4 1000000 1662 ns/op 2464.13 MB/s -BenchmarkMemclr65536-4 30000 50428 ns/op 1299.58 MB/s -BenchmarkMemclr1M-4 2000 875472 ns/op 1197.73 MB/s -BenchmarkMemclr4M-4 500 3529939 ns/op 1188.21 MB/s -BenchmarkMemclr8M-4 200 7088731 ns/op 1183.37 MB/s -BenchmarkMemclr16M-4 100 14275180 ns/op 1175.27 MB/s -BenchmarkMemclr64M-4 20 59343321 ns/op 1130.86 MB/s -BenchmarkGoMemclr5-4 20000000 61.4 ns/op 81.44 MB/s -BenchmarkGoMemclr16-4 20000000 81.7 ns/op 195.78 MB/s -BenchmarkGoMemclr64-4 20000000 69.8 ns/op 917.14 MB/s -BenchmarkGoMemclr256-4 20000000 109 ns/op 2339.84 MB/s -BenchmarkClearFat8-4 200000000 7.84 ns/op -BenchmarkClearFat12-4 200000000 8.93 ns/op -BenchmarkClearFat16-4 100000000 10.1 ns/op -BenchmarkClearFat24-4 100000000 12.3 ns/op -BenchmarkClearFat32-4 100000000 14.5 ns/op -BenchmarkClearFat40-4 30000000 52.4 ns/op -BenchmarkClearFat48-4 20000000 60.3 ns/op -BenchmarkClearFat56-4 20000000 65.9 ns/op -BenchmarkClearFat64-4 20000000 73.8 ns/op -BenchmarkClearFat128-4 10000000 126 ns/op -BenchmarkClearFat256-4 10000000 234 ns/op -BenchmarkClearFat512-4 3000000 448 ns/op -BenchmarkClearFat1024-4 2000000 872 ns/op -BenchmarkCopyFat8-4 200000000 6.72 ns/op -BenchmarkCopyFat12-4 200000000 7.80 ns/op -BenchmarkCopyFat16-4 200000000 8.93 ns/op -BenchmarkCopyFat24-4 100000000 11.2 ns/op -BenchmarkCopyFat32-4 100000000 17.9 ns/op -BenchmarkCopyFat64-4 20000000 75.0 ns/op -BenchmarkCopyFat128-4 10000000 128 ns/op -BenchmarkCopyFat256-4 10000000 236 ns/op -BenchmarkCopyFat512-4 3000000 449 ns/op -BenchmarkCopyFat1024-4 2000000 879 ns/op -BenchmarkFinalizer-4 500 3830391 ns/op -BenchmarkFinalizerRun-4 200000 6697 ns/op -BenchmarkSyscall-4 5000000 296 ns/op -BenchmarkSyscallWork-4 3000000 551 ns/op -BenchmarkSyscallExcess-4 5000000 296 ns/op -BenchmarkSyscallExcessWork-4 3000000 552 ns/op -BenchmarkPingPongHog-4 100000 13315 ns/op -BenchmarkStackGrowth-4 500000 2461 ns/op -BenchmarkStackGrowthDeep-4 2000 1028254 ns/op -BenchmarkCreateGoroutines-4 500000 2722 ns/op -BenchmarkCreateGoroutinesParallel-4 2000000 649 ns/op -BenchmarkCreateGoroutinesCapture-4 100000 21739 ns/op 16 B/op 1 allocs/op -BenchmarkClosureCall-4 30000000 48.0 ns/op -BenchmarkMatmult-4 50000000 40.3 ns/op -BenchmarkIfaceCmp100-4 500000 2369 ns/op -BenchmarkIfaceCmpNil100-4 500000 2475 ns/op -BenchmarkDefer-4 1000000 1203 ns/op -BenchmarkDefer10-4 1000000 1089 ns/op -BenchmarkDeferMany-4 1000000 2045 ns/op -BenchmarkStackCopy-4 1 2767373639 ns/op -BenchmarkCompareStringEqual-4 10000000 140 ns/op -BenchmarkCompareStringIdentical-4 30000000 41.4 ns/op -BenchmarkCompareStringSameLength-4 20000000 92.0 ns/op -BenchmarkCompareStringDifferentLength-4 100000000 13.4 ns/op -BenchmarkCompareStringBigUnaligned-4 100 11917034 ns/op 87.99 MB/s -BenchmarkCompareStringBig-4 200 10163432 ns/op 103.17 MB/s -BenchmarkRuneIterate-4 500000 3969 ns/op -BenchmarkRuneIterate2-4 500000 3947 ns/op -BenchmarkUint32Div7-4 20000000 102 ns/op -BenchmarkUint32Div37-4 20000000 102 ns/op -BenchmarkUint32Div123-4 20000000 102 ns/op -BenchmarkUint32Div763-4 20000000 102 ns/op -BenchmarkUint32Div1247-4 20000000 102 ns/op -BenchmarkUint32Div9305-4 20000000 102 ns/op -BenchmarkUint32Div13307-4 20000000 102 ns/op -BenchmarkUint32Div52513-4 20000000 103 ns/op -BenchmarkUint32Div60978747-4 20000000 98.7 ns/op -BenchmarkUint32Div106956295-4 20000000 100.0 ns/op -BenchmarkUint32Mod7-4 20000000 102 ns/op -BenchmarkUint32Mod37-4 20000000 102 ns/op -BenchmarkUint32Mod123-4 20000000 102 ns/op -BenchmarkUint32Mod763-4 20000000 103 ns/op -BenchmarkUint32Mod1247-4 20000000 103 ns/op -BenchmarkUint32Mod9305-4 20000000 102 ns/op -BenchmarkUint32Mod13307-4 20000000 102 ns/op -BenchmarkUint32Mod52513-4 20000000 103 ns/op -BenchmarkUint32Mod60978747-4 20000000 100 ns/op -BenchmarkUint32Mod106956295-4 20000000 100 ns/op -ok runtime 562.289s -``` - -## Raspberry Pi Zero - -Architecture: 1 GHz ARM1176JZF-S, running at 700Mhz; 512MB RAM - -Operating System: Raspbian Jessie - -``` -$ go version -go version devel +5c24832 Sat Dec 5 00:10:40 2015 +0000 linux/arm - -$ go test -timeout 20m -v -bench=Benchmark -run=X -PASS -BenchmarkAppend 3000000 518 ns/op -BenchmarkAppendGrowByte 20 95720661 ns/op -BenchmarkAppendGrowString 1 2232033275 ns/op -BenchmarkAppend1Byte 20000000 99.0 ns/op -BenchmarkAppend4Bytes 10000000 120 ns/op -BenchmarkAppend7Bytes 10000000 155 ns/op -BenchmarkAppend8Bytes 10000000 132 ns/op -BenchmarkAppend15Bytes 10000000 162 ns/op -BenchmarkAppend16Bytes 10000000 134 ns/op -BenchmarkAppend32Bytes 10000000 121 ns/op -BenchmarkAppendStr1Byte 20000000 97.0 ns/op -BenchmarkAppendStr4Bytes 10000000 118 ns/op -BenchmarkAppendStr8Bytes 10000000 129 ns/op -BenchmarkAppendStr16Bytes 10000000 132 ns/op -BenchmarkAppendStr32Bytes 10000000 121 ns/op -BenchmarkAppendSpecialCase 2000000 791 ns/op -BenchmarkCopy1Byte 10000000 132 ns/op 7.54 MB/s -BenchmarkCopy2Byte 10000000 144 ns/op 13.81 MB/s -BenchmarkCopy4Byte 10000000 153 ns/op 26.12 MB/s -BenchmarkCopy8Byte 10000000 164 ns/op 48.51 MB/s -BenchmarkCopy12Byte 10000000 162 ns/op 74.03 MB/s -BenchmarkCopy16Byte 10000000 167 ns/op 95.63 MB/s -BenchmarkCopy32Byte 10000000 155 ns/op 205.20 MB/s -BenchmarkCopy128Byte 10000000 192 ns/op 664.06 MB/s -BenchmarkCopy1024Byte 2000000 689 ns/op 1484.28 MB/s -BenchmarkCopy1String 10000000 120 ns/op 8.27 MB/s -BenchmarkCopy2String 10000000 134 ns/op 14.85 MB/s -BenchmarkCopy4String 10000000 142 ns/op 28.01 MB/s -BenchmarkCopy8String 10000000 154 ns/op 51.81 MB/s -BenchmarkCopy12String 10000000 151 ns/op 79.01 MB/s -BenchmarkCopy16String 10000000 157 ns/op 101.82 MB/s -BenchmarkCopy32String 10000000 145 ns/op 219.52 MB/s -BenchmarkCopy128String 10000000 182 ns/op 700.88 MB/s -BenchmarkCopy1024String 2000000 976 ns/op 1048.87 MB/s -BenchmarkChanNonblocking 5000000 246 ns/op -BenchmarkSelectUncontended 500000 3610 ns/op -BenchmarkSelectSyncContended 100000 18957 ns/op -BenchmarkSelectAsyncContended 500000 3614 ns/op -BenchmarkSelectNonblock 2000000 814 ns/op -BenchmarkChanUncontended 10000 135820 ns/op -BenchmarkChanContended 10000 133122 ns/op -BenchmarkChanSync 200000 5870 ns/op -BenchmarkChanProdCons0 200000 5899 ns/op -BenchmarkChanProdCons10 500000 2138 ns/op -BenchmarkChanProdCons100 1000000 1557 ns/op -BenchmarkChanProdConsWork0 200000 8948 ns/op -BenchmarkChanProdConsWork10 300000 5043 ns/op -BenchmarkChanProdConsWork100 300000 4498 ns/op -BenchmarkSelectProdCons 200000 10818 ns/op -BenchmarkChanCreation 500000 3187 ns/op -BenchmarkChanSem 1000000 1266 ns/op -BenchmarkChanPopular 100 14315946 ns/op -BenchmarkCallClosure 30000000 50.0 ns/op -BenchmarkCallClosure1 30000000 56.3 ns/op -BenchmarkCallClosure2 3000000 512 ns/op -BenchmarkCallClosure3 3000000 503 ns/op -BenchmarkCallClosure4 3000000 512 ns/op -BenchmarkComplex128DivNormal 2000000 735 ns/op -BenchmarkComplex128DivNisNaN 200000 6001 ns/op -BenchmarkComplex128DivDisNaN 200000 5992 ns/op -BenchmarkComplex128DivNisInf 5000000 390 ns/op -BenchmarkComplex128DivDisInf 5000000 375 ns/op -BenchmarkSetTypePtr 10000000 119 ns/op 33.43 MB/s -BenchmarkSetTypePtr8 10000000 227 ns/op 140.89 MB/s -BenchmarkSetTypePtr16 5000000 285 ns/op 224.30 MB/s -BenchmarkSetTypePtr32 5000000 388 ns/op 329.65 MB/s -BenchmarkSetTypePtr64 3000000 591 ns/op 432.77 MB/s -BenchmarkSetTypePtr126 1000000 1021 ns/op 493.46 MB/s -BenchmarkSetTypePtr128 1000000 1003 ns/op 510.46 MB/s -BenchmarkSetTypePtrSlice 200000 7427 ns/op 551.43 MB/s -BenchmarkSetTypeNode1 10000000 217 ns/op 55.20 MB/s -BenchmarkSetTypeNode1Slice 1000000 1284 ns/op 299.03 MB/s -BenchmarkSetTypeNode8 5000000 277 ns/op 144.17 MB/s -BenchmarkSetTypeNode8Slice 500000 2825 ns/op 453.02 MB/s -BenchmarkSetTypeNode64 2000000 661 ns/op 398.89 MB/s -BenchmarkSetTypeNode64Slice 100000 15531 ns/op 543.92 MB/s -BenchmarkSetTypeNode64Dead 5000000 382 ns/op 689.66 MB/s -BenchmarkSetTypeNode64DeadSlice 100000 13252 ns/op 637.46 MB/s -BenchmarkSetTypeNode124 1000000 1017 ns/op 495.27 MB/s -BenchmarkSetTypeNode124Slice 50000 28139 ns/op 573.14 MB/s -BenchmarkSetTypeNode126 2000000 1001 ns/op 511.10 MB/s -BenchmarkSetTypeNode126Slice 50000 26535 ns/op 617.43 MB/s -BenchmarkSetTypeNode128 1000000 1087 ns/op 478.22 MB/s -BenchmarkSetTypeNode128Slice 50000 29166 ns/op 570.52 MB/s -BenchmarkSetTypeNode130 1000000 1067 ns/op 494.83 MB/s -BenchmarkSetTypeNode130Slice 50000 29691 ns/op 569.04 MB/s -BenchmarkSetTypeNode1024 200000 7155 ns/op 573.51 MB/s -BenchmarkSetTypeNode1024Slice 5000 224292 ns/op 585.52 MB/s -BenchmarkAllocation 2000 957094 ns/op -BenchmarkHash5 5000000 349 ns/op 14.29 MB/s -BenchmarkHash16 3000000 436 ns/op 36.66 MB/s -BenchmarkHash64 1000000 1007 ns/op 63.49 MB/s -BenchmarkHash1024 200000 11267 ns/op 90.88 MB/s -BenchmarkHash65536 2000 797741 ns/op 82.15 MB/s -BenchmarkEqEfaceConcrete 20000000 111 ns/op -BenchmarkEqIfaceConcrete 20000000 106 ns/op -BenchmarkNeEfaceConcrete 20000000 111 ns/op -BenchmarkNeIfaceConcrete 20000000 106 ns/op -BenchmarkConvT2ESmall 3000000 561 ns/op -BenchmarkConvT2EUintptr 2000000 599 ns/op -BenchmarkConvT2ELarge 2000000 767 ns/op -BenchmarkConvT2ISmall 2000000 724 ns/op -BenchmarkConvT2IUintptr 2000000 750 ns/op -BenchmarkConvT2ILarge 2000000 907 ns/op -BenchmarkConvI2E 20000000 76.7 ns/op -BenchmarkConvI2I 3000000 425 ns/op -BenchmarkAssertE2T 10000000 176 ns/op -BenchmarkAssertE2TLarge 10000000 189 ns/op -BenchmarkAssertE2I 3000000 455 ns/op -BenchmarkAssertI2T 10000000 176 ns/op -BenchmarkAssertI2I 3000000 451 ns/op -BenchmarkAssertI2E 20000000 109 ns/op -BenchmarkAssertE2E 30000000 40.7 ns/op -BenchmarkAssertE2T2 10000000 180 ns/op -BenchmarkAssertE2T2Blank 50000000 22.8 ns/op -BenchmarkAssertI2E2 20000000 117 ns/op -BenchmarkAssertI2E2Blank 100000000 21.7 ns/op -BenchmarkAssertE2E2 10000000 231 ns/op -BenchmarkAssertE2E2Blank 100000000 21.8 ns/op -BenchmarkMalloc8 3000000 507 ns/op -BenchmarkMalloc16 2000000 848 ns/op -BenchmarkMallocTypeInfo8 2000000 1012 ns/op -BenchmarkMallocTypeInfo16 1000000 1168 ns/op -BenchmarkMallocLargeStruct 500000 4823 ns/op -BenchmarkGoroutineSelect 20 76172338 ns/op -BenchmarkGoroutineBlocking 20 63469806 ns/op -BenchmarkGoroutineForRange 20 64107650 ns/op -BenchmarkGoroutineIdle 20 60844381 ns/op -BenchmarkMapPop100 3000 409498 ns/op -BenchmarkMapPop1000 200 7783817 ns/op -BenchmarkMapPop10000 10 170736704 ns/op -BenchmarkHashStringSpeed 3000000 541 ns/op -BenchmarkHashBytesSpeed 1000000 1157 ns/op -BenchmarkHashInt32Speed 5000000 371 ns/op -BenchmarkHashInt64Speed 3000000 427 ns/op -BenchmarkHashStringArraySpeed 1000000 1417 ns/op -BenchmarkMegMap 3000000 404 ns/op -BenchmarkMegOneMap 5000000 346 ns/op -BenchmarkMegEqMap 100 16663414 ns/op -BenchmarkMegEmptyMap 10000000 160 ns/op -BenchmarkSmallStrMap 3000000 415 ns/op -BenchmarkMapStringKeysEight_16 3000000 417 ns/op -BenchmarkMapStringKeysEight_32 3000000 420 ns/op -BenchmarkMapStringKeysEight_64 3000000 420 ns/op -BenchmarkMapStringKeysEight_1M 3000000 419 ns/op -BenchmarkIntMap 10000000 220 ns/op -BenchmarkRepeatedLookupStrMapKey32 1000000 1015 ns/op -BenchmarkRepeatedLookupStrMapKey1M 100 15652033 ns/op -BenchmarkNewEmptyMap 1000000 1395 ns/op 0 B/op 0 allocs/op -BenchmarkNewSmallMap 300000 3368 ns/op 0 B/op 0 allocs/op -BenchmarkMapIter 500000 2947 ns/op -BenchmarkMapIterEmpty 20000000 163 ns/op -BenchmarkSameLengthMap 10000000 133 ns/op -BenchmarkBigKeyMap 2000000 899 ns/op -BenchmarkBigValMap 2000000 922 ns/op -BenchmarkSmallKeyMap 3000000 402 ns/op -BenchmarkComplexAlgMap 1000000 2003 ns/op -BenchmarkMemmove0 20000000 61.4 ns/op -BenchmarkMemmove1 20000000 76.6 ns/op 13.05 MB/s -BenchmarkMemmove2 20000000 86.3 ns/op 23.18 MB/s -BenchmarkMemmove3 20000000 83.7 ns/op 35.83 MB/s -BenchmarkMemmove4 20000000 88.0 ns/op 45.48 MB/s -BenchmarkMemmove5 20000000 110 ns/op 45.37 MB/s -BenchmarkMemmove6 20000000 115 ns/op 51.99 MB/s -BenchmarkMemmove7 10000000 123 ns/op 56.89 MB/s -BenchmarkMemmove8 20000000 99.5 ns/op 80.44 MB/s -BenchmarkMemmove9 20000000 112 ns/op 79.76 MB/s -BenchmarkMemmove10 10000000 125 ns/op 79.48 MB/s -BenchmarkMemmove11 10000000 125 ns/op 87.84 MB/s -BenchmarkMemmove12 20000000 96.9 ns/op 123.87 MB/s -BenchmarkMemmove13 20000000 110 ns/op 117.83 MB/s -BenchmarkMemmove14 10000000 123 ns/op 113.65 MB/s -BenchmarkMemmove15 10000000 122 ns/op 122.30 MB/s -BenchmarkMemmove16 20000000 101 ns/op 156.89 MB/s -BenchmarkMemmove32 20000000 90.8 ns/op 352.44 MB/s -BenchmarkMemmove64 20000000 108 ns/op 588.34 MB/s -BenchmarkMemmove128 10000000 127 ns/op 1001.83 MB/s -BenchmarkMemmove256 10000000 178 ns/op 1436.19 MB/s -BenchmarkMemmove512 5000000 326 ns/op 1569.07 MB/s -BenchmarkMemmove1024 2000000 631 ns/op 1620.84 MB/s -BenchmarkMemmove2048 1000000 1251 ns/op 1636.60 MB/s -BenchmarkMemmove4096 500000 2499 ns/op 1638.97 MB/s -BenchmarkMemmoveUnaligned0 20000000 72.5 ns/op -BenchmarkMemmoveUnaligned1 20000000 87.8 ns/op 11.39 MB/s -BenchmarkMemmoveUnaligned2 20000000 99.4 ns/op 20.12 MB/s -BenchmarkMemmoveUnaligned3 20000000 96.9 ns/op 30.96 MB/s -BenchmarkMemmoveUnaligned4 10000000 135 ns/op 29.44 MB/s -BenchmarkMemmoveUnaligned5 10000000 147 ns/op 33.90 MB/s -BenchmarkMemmoveUnaligned6 10000000 146 ns/op 41.09 MB/s -BenchmarkMemmoveUnaligned7 10000000 151 ns/op 46.27 MB/s -BenchmarkMemmoveUnaligned8 10000000 156 ns/op 51.22 MB/s -BenchmarkMemmoveUnaligned9 10000000 161 ns/op 55.82 MB/s -BenchmarkMemmoveUnaligned10 10000000 166 ns/op 60.09 MB/s -BenchmarkMemmoveUnaligned11 10000000 171 ns/op 64.17 MB/s -BenchmarkMemmoveUnaligned12 10000000 177 ns/op 67.79 MB/s -BenchmarkMemmoveUnaligned13 10000000 181 ns/op 71.60 MB/s -BenchmarkMemmoveUnaligned14 10000000 189 ns/op 74.03 MB/s -BenchmarkMemmoveUnaligned15 10000000 196 ns/op 76.30 MB/s -BenchmarkMemmoveUnaligned16 10000000 200 ns/op 79.91 MB/s -BenchmarkMemmoveUnaligned32 10000000 221 ns/op 144.64 MB/s -BenchmarkMemmoveUnaligned64 5000000 290 ns/op 220.16 MB/s -BenchmarkMemmoveUnaligned128 3000000 413 ns/op 309.84 MB/s -BenchmarkMemmoveUnaligned256 2000000 766 ns/op 334.16 MB/s -BenchmarkMemmoveUnaligned512 2000000 925 ns/op 553.13 MB/s -BenchmarkMemmoveUnaligned1024 500000 2747 ns/op 372.66 MB/s -BenchmarkMemmoveUnaligned2048 500000 3180 ns/op 643.85 MB/s -BenchmarkMemmoveUnaligned4096 200000 6206 ns/op 659.99 MB/s -BenchmarkMemclr5 20000000 105 ns/op 47.53 MB/s -BenchmarkMemclr16 20000000 110 ns/op 144.77 MB/s -BenchmarkMemclr64 10000000 125 ns/op 511.58 MB/s -BenchmarkMemclr256 10000000 182 ns/op 1402.34 MB/s -BenchmarkMemclr4096 500000 2489 ns/op 1645.22 MB/s -BenchmarkMemclr65536 50000 39883 ns/op 1643.18 MB/s -BenchmarkMemclr1M 2000 636812 ns/op 1646.60 MB/s -BenchmarkMemclr4M 500 2549362 ns/op 1645.24 MB/s -BenchmarkMemclr8M 300 5162451 ns/op 1624.93 MB/s -BenchmarkMemclr16M 200 10300878 ns/op 1628.72 MB/s -BenchmarkMemclr64M 30 42801198 ns/op 1567.92 MB/s -BenchmarkGoMemclr5 20000000 73.5 ns/op 67.99 MB/s -BenchmarkGoMemclr16 20000000 85.9 ns/op 186.24 MB/s -BenchmarkGoMemclr64 20000000 87.8 ns/op 729.24 MB/s -BenchmarkGoMemclr256 10000000 160 ns/op 1591.97 MB/s -BenchmarkClearFat8 100000000 15.6 ns/op -BenchmarkClearFat12 100000000 27.5 ns/op -BenchmarkClearFat16 100000000 32.4 ns/op -BenchmarkClearFat24 50000000 57.0 ns/op -BenchmarkClearFat32 50000000 80.5 ns/op -BenchmarkClearFat40 30000000 77.5 ns/op -BenchmarkClearFat48 30000000 105 ns/op -BenchmarkClearFat56 20000000 87.1 ns/op -BenchmarkClearFat64 20000000 137 ns/op -BenchmarkClearFat128 20000000 278 ns/op -BenchmarkClearFat256 5000000 537 ns/op -BenchmarkClearFat512 2000000 1293 ns/op -BenchmarkClearFat1024 1000000 2545 ns/op -BenchmarkCopyFat8 100000000 12.2 ns/op -BenchmarkCopyFat12 100000000 20.3 ns/op -BenchmarkCopyFat16 100000000 34.3 ns/op -BenchmarkCopyFat24 50000000 27.7 ns/op -BenchmarkCopyFat32 50000000 25.4 ns/op -BenchmarkCopyFat64 20000000 135 ns/op -BenchmarkCopyFat128 10000000 299 ns/op -BenchmarkCopyFat256 2000000 571 ns/op -BenchmarkCopyFat512 1000000 1218 ns/op -BenchmarkCopyFat1024 500000 2665 ns/op -BenchmarkFinalizer 50 20313669 ns/op -BenchmarkFinalizerRun 30000 49987 ns/op -BenchmarkSyscall 1000000 1625 ns/op -BenchmarkSyscallWork 500000 2668 ns/op -BenchmarkSyscallExcess 1000000 1613 ns/op -BenchmarkSyscallExcessWork 500000 2658 ns/op -BenchmarkPingPongHog 100000 20539 ns/op -BenchmarkStackGrowth 50000 28473 ns/op -BenchmarkStackGrowthDeep 500 2845263 ns/op -BenchmarkCreateGoroutines 300000 4297 ns/op -BenchmarkCreateGoroutinesParallel 300000 4300 ns/op -BenchmarkCreateGoroutinesCapture 50000 33218 ns/op 16 B/op 1 allocs/op -BenchmarkClosureCall 30000000 55.1 ns/op -BenchmarkMatmult 10000000 196 ns/op -BenchmarkIfaceCmp100 500000 2672 ns/op -BenchmarkIfaceCmpNil100 500000 2982 ns/op -BenchmarkDefer 1000000 1819 ns/op -BenchmarkDefer10 1000000 1478 ns/op -BenchmarkDeferMany 500000 3464 ns/op -BenchmarkStackCopy 1 3714828065 ns/op -BenchmarkCompareStringEqual 10000000 160 ns/op -BenchmarkCompareStringIdentical 30000000 54.1 ns/op -BenchmarkCompareStringSameLength 20000000 111 ns/op -BenchmarkCompareStringDifferentLength 100000000 16.3 ns/op -BenchmarkCompareStringBigUnaligned 100 16695582 ns/op 62.81 MB/s -BenchmarkCompareStringBig 100 17208318 ns/op 60.93 MB/s -BenchmarkRuneIterate 300000 5159 ns/op -BenchmarkRuneIterate2 300000 5158 ns/op -BenchmarkUint32Div7 10000000 144 ns/op -BenchmarkUint32Div37 10000000 144 ns/op -BenchmarkUint32Div123 10000000 144 ns/op -BenchmarkUint32Div763 10000000 148 ns/op -BenchmarkUint32Div1247 10000000 144 ns/op -BenchmarkUint32Div9305 10000000 144 ns/op -BenchmarkUint32Div13307 10000000 144 ns/op -BenchmarkUint32Div52513 10000000 144 ns/op -BenchmarkUint32Div60978747 10000000 131 ns/op -BenchmarkUint32Div106956295 10000000 131 ns/op -BenchmarkUint32Mod7 10000000 144 ns/op -BenchmarkUint32Mod37 10000000 144 ns/op -BenchmarkUint32Mod123 10000000 144 ns/op -BenchmarkUint32Mod763 10000000 144 ns/op -BenchmarkUint32Mod1247 10000000 144 ns/op -BenchmarkUint32Mod9305 10000000 144 ns/op -BenchmarkUint32Mod13307 10000000 144 ns/op -BenchmarkUint32Mod52513 10000000 144 ns/op -BenchmarkUint32Mod60978747 10000000 131 ns/op -BenchmarkUint32Mod106956295 10000000 131 ns/op -ok runtime 566.969s -``` - -## ODROID-X - -Architecture: ARMv7 quad-core Cortex-A9 (Samsung Exynos 4412 1.4GHz), 1GB RAM, Mali graphics (untested). - -Operating System: [Archlinux ARM](http://archlinuxarm.org/) - -Go pre-1.1 compiles out of the box. The four cores make it particularly suited to Go multi-threaded programs. An ODROID-X2 is coming (Nov 2012) with more RAM. - -_-- Rémy Oudompheng_ - -## BananaPi - -[BananaPi](http://banana-pi.org) has a few enhanced hardware components compare with Raspberry Pi. - -| **Architecture** | **Comments** | -|:-----------------|:-------------| -| [Allwinner A20(ARM Cortex-A7 Dual-core, 1GHz, Mali400MP2 GPU)](http://www.allwinnertech.com/en/clq/processora/A20.html) | tbc | -| eSATA | No worry to wear out your root SD Card| -| Onboard Microphone | tbc | -| 1G Etherenet | tbc | -| 1G RAM | tbc | -| Reset Switch | To reset the board ?| -| Power Switch | To power cycle the board ?| - -``` -root@bpi01:/data/go13/src# cat ./buildgo.bash -#!/bin/bash -# use 1 CPU to avoid out of memory compilation issue. -time taskset 2 ./make.bash - -root@bpi01:/data/go13/src# ./buildgo.bash - - - -Installed Go for linux/arm in /data/go1.3 -Installed commands in /data/go1.3/bin - -real 9m9.222s -user 8m18.960s -sys 0m40.920s -root@bpi01:/data/go1.3/src# -``` - -_--T.J. Yang_ - -## AppliedMicro X-Gene (ARMv8) - -Architecture: ARMv8 (64-bit) 8-core, 2.4GHz, 16GB RAM - -Operating Systems: Linux, Fedora 21 - -You will need to cross-compile a toolchain using bootstrap.bash. After you copy it to the arm64 system and set `GOROOT_BOOTSTRAP`, you can build go natively. - -## 96Boards HiKey (ARMv8) - -Architecture: ARMv8 (64-bit) 8-core, 1.2GHz, 1GB RAM - -Operating System: Linux (Linaro) - -Go Version: 1.5Beta1 - -Special Notes: Enable a swap partition (<=1GB is fine). Build process is CPU-intensive and may cause the internal 90C temperature threshold to be exceeded - keep the HiKey cool during the build. - -As mentioned above, use bootstrap.sh (e.g. on Ubuntu AMD64) for ARM64, then transfer over the bootstrap tbx file, untar it, and use it as GOROOT_BOOTSTRAP. Check out the Go sources into a separate GOROOT, and build. - -_--Andrew Cencini_ (andrew@vapor.io) - -## Scaleway C1 Server - -Architecture: armv7l - -Operating System: Debian 8.2 (armhf) - -Go Version: 1.5 - -The Scaleway C1 Server is a dedicated ARM server with 2GiB RAM using a SAN for storage. - -I used the following guide: [Building Go 1.5 on the Raspberry Pi](http://dave.cheney.net/2015/09/04/building-go-1-5-on-the-raspberry-pi) - -_--Laurent Debacker - -## Jetson Nano - -Jetson Nano™ from NVIDIA® is a high performance low-power single board computer built for edge Artificial Intelligence computing. It has Quad-core ARM57 based CPU clocked at 1.43 Ghz, 128-core Maxwell based GPU and 4GB of LPDDR4 memory with 25.6 GB/s bandwidth. - -Architecture: ARMv8-A - -Operating System: Jetson Nano Developer Kit (Ubuntu 18.04 LTS) with JetPack 4.2 - -Kernel: I'm using a custom compiled official kernel with patch for enabling Zswap and having the root file system in a USB SSD. The procedure for doing this is detailed in [Syonyk's blog](https://syonyk.blogspot.com/2019/04/nvidia-jetson-nano-desktop-use-kernel-builds.html). -``` -abishek@Titan:~$ uname -a -Linux Titan 4.9.140 #1 SMP PREEMPT Thu May 23 01:33:05 IST 2019 aarch64 aarch64 aarch64 GNU/Linux -``` - -Go Version: -``` -abishek@Titan:~$ go version -go version go1.12.5 linux/arm64 -``` -I used the ARMv8 version from [Other Ports](https://go.dev/dl/) section of official downloads. -I set the following system wide environment variables in /etc/environment. -``` -GOROOT="/usr/local/go" -GOPATH="/home/abishek/Developer/go/packages" -PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/go/bin:/home/abishek/Developer/go/packages/bin" -LANG="en_IN" -``` - -Benchmarks: - -HW configuration : 5V 4A power via DC barrel jack. Noctua 40mm PWM fan. Samsung 840 EVO 120 GB SSD. - -SW configuration : Headless. Zswap. 12 GB swap partition. - -Simple benchmark. -``` -abishek@Titan:~$ cd $GOROOT/src/runtime -$ go test -test.bench=BenchmarkUint -PASS -ok runtime 329.992s -``` -Extensive benchmarks. -``` -$ go test -test.bench=".*" -test.timeout="60m" -goos: linux -goarch: arm64 -pkg: runtime -BenchmarkMakeChan/Byte-4 10000000 219 ns/op -BenchmarkMakeChan/Int-4 5000000 298 ns/op -BenchmarkMakeChan/Ptr-4 3000000 452 ns/op -BenchmarkMakeChan/Struct/0-4 10000000 196 ns/op -BenchmarkMakeChan/Struct/32-4 3000000 519 ns/op -BenchmarkMakeChan/Struct/40-4 3000000 592 ns/op -BenchmarkChanNonblocking-4 200000000 7.93 ns/op -BenchmarkSelectUncontended-4 10000000 124 ns/op -BenchmarkSelectSyncContended-4 200000 7358 ns/op -BenchmarkSelectAsyncContended-4 2000000 671 ns/op -BenchmarkSelectNonblock-4 100000000 22.7 ns/op -BenchmarkChanUncontended-4 200000 6956 ns/op -BenchmarkChanContended-4 30000 51996 ns/op -BenchmarkChanSync-4 1000000 1118 ns/op -BenchmarkChanSyncWork-4 200000 11784 ns/op -BenchmarkChanProdCons0-4 2000000 817 ns/op -BenchmarkChanProdCons10-4 2000000 656 ns/op -BenchmarkChanProdCons100-4 3000000 561 ns/op -BenchmarkChanProdConsWork0-4 2000000 803 ns/op -BenchmarkChanProdConsWork10-4 2000000 706 ns/op -BenchmarkChanProdConsWork100-4 2000000 633 ns/op -BenchmarkSelectProdCons-4 1000000 1411 ns/op -BenchmarkChanCreation-4 10000000 206 ns/op -BenchmarkChanSem-4 3000000 502 ns/op -BenchmarkChanPopular-4 1000 1503920 ns/op -BenchmarkCallClosure-4 200000000 6.54 ns/op -BenchmarkCallClosure1-4 300000000 5.94 ns/op -BenchmarkCallClosure2-4 20000000 72.0 ns/op -BenchmarkCallClosure3-4 20000000 77.9 ns/op -BenchmarkCallClosure4-4 20000000 74.6 ns/op -BenchmarkComplex128DivNormal-4 20000000 72.3 ns/op -BenchmarkComplex128DivNisNaN-4 30000000 47.0 ns/op -BenchmarkComplex128DivDisNaN-4 20000000 67.6 ns/op -BenchmarkComplex128DivNisInf-4 50000000 38.7 ns/op -BenchmarkComplex128DivDisInf-4 20000000 79.3 ns/op -BenchmarkSetTypePtr-4 200000000 8.54 ns/op 936.87 MB/s -BenchmarkSetTypePtr8-4 50000000 37.2 ns/op 1720.14 MB/s -BenchmarkSetTypePtr16-4 30000000 45.6 ns/op 2806.20 MB/s -BenchmarkSetTypePtr32-4 20000000 60.4 ns/op 4236.17 MB/s -BenchmarkSetTypePtr64-4 20000000 110 ns/op 4615.47 MB/s -BenchmarkSetTypePtr126-4 10000000 171 ns/op 5892.51 MB/s -BenchmarkSetTypePtr128-4 10000000 169 ns/op 6030.73 MB/s -BenchmarkSetTypePtrSlice-4 1000000 1589 ns/op 5154.84 MB/s -BenchmarkSetTypeNode1-4 50000000 33.7 ns/op 712.62 MB/s -BenchmarkSetTypeNode1Slice-4 10000000 197 ns/op 3881.85 MB/s -BenchmarkSetTypeNode8-4 30000000 42.1 ns/op 1899.69 MB/s -BenchmarkSetTypeNode8Slice-4 3000000 558 ns/op 4584.96 MB/s -BenchmarkSetTypeNode64-4 10000000 128 ns/op 4123.56 MB/s -BenchmarkSetTypeNode64Slice-4 500000 2707 ns/op 6240.73 MB/s -BenchmarkSetTypeNode64Dead-4 20000000 72.4 ns/op 7291.77 MB/s -BenchmarkSetTypeNode64DeadSlice-4 500000 3203 ns/op 5274.16 MB/s -BenchmarkSetTypeNode124-4 10000000 169 ns/op 5961.36 MB/s -BenchmarkSetTypeNode124Slice-4 300000 4505 ns/op 7159.55 MB/s -BenchmarkSetTypeNode126-4 10000000 171 ns/op 5971.04 MB/s -BenchmarkSetTypeNode126Slice-4 300000 4430 ns/op 7395.67 MB/s -BenchmarkSetTypeNode128-4 10000000 181 ns/op 5737.43 MB/s -BenchmarkSetTypeNode128Slice-4 300000 4958 ns/op 6711.13 MB/s -BenchmarkSetTypeNode130-4 10000000 183 ns/op 5764.99 MB/s -BenchmarkSetTypeNode130Slice-4 300000 5092 ns/op 6635.64 MB/s -BenchmarkSetTypeNode1024-4 1000000 1104 ns/op 7430.05 MB/s -BenchmarkSetTypeNode1024Slice-4 50000 32624 ns/op 8050.89 MB/s -BenchmarkAllocation-4 30000 42818 ns/op -BenchmarkReadMemStats-4 50000 26260 ns/op -BenchmarkWriteBarrier-4 20000000 59.5 ns/op -BenchmarkBulkWriteBarrier-4 50000000 30.4 ns/op -BenchmarkScanStackNoLocals-4 10 161375576 ns/op -BenchmarkHash5-4 50000000 24.4 ns/op 205.24 MB/s -BenchmarkHash16-4 100000000 22.9 ns/op 698.97 MB/s -BenchmarkHash64-4 50000000 36.2 ns/op 1766.78 MB/s -BenchmarkHash1024-4 10000000 144 ns/op 7062.29 MB/s -BenchmarkHash65536-4 200000 7637 ns/op 8580.67 MB/s -BenchmarkAlignedLoad-4 200000000 7.74 ns/op -BenchmarkUnalignedLoad-4 200000000 7.72 ns/op -BenchmarkEqEfaceConcrete-4 500000000 3.51 ns/op -BenchmarkEqIfaceConcrete-4 500000000 3.86 ns/op -BenchmarkNeEfaceConcrete-4 500000000 3.51 ns/op -BenchmarkNeIfaceConcrete-4 500000000 3.86 ns/op -BenchmarkConvT2ESmall-4 100000000 10.9 ns/op -BenchmarkConvT2EUintptr-4 100000000 10.7 ns/op -BenchmarkConvT2ELarge-4 20000000 119 ns/op -BenchmarkConvT2ISmall-4 100000000 11.0 ns/op -BenchmarkConvT2IUintptr-4 100000000 10.5 ns/op -BenchmarkConvT2ILarge-4 20000000 118 ns/op -BenchmarkConvI2E-4 300000000 5.43 ns/op -BenchmarkConvI2I-4 30000000 52.5 ns/op -BenchmarkAssertE2T-4 500000000 3.79 ns/op -BenchmarkAssertE2TLarge-4 200000000 7.13 ns/op -BenchmarkAssertE2I-4 30000000 53.3 ns/op -BenchmarkAssertI2T-4 500000000 3.75 ns/op -BenchmarkAssertI2I-4 30000000 54.0 ns/op -BenchmarkAssertI2E-4 300000000 5.38 ns/op -BenchmarkAssertE2E-4 300000000 4.91 ns/op -BenchmarkAssertE2T2-4 300000000 4.91 ns/op -BenchmarkAssertE2T2Blank-4 500000000 3.04 ns/op -BenchmarkAssertI2E2-4 200000000 6.67 ns/op -BenchmarkAssertI2E2Blank-4 500000000 3.04 ns/op -BenchmarkAssertE2E2-4 200000000 6.32 ns/op -BenchmarkAssertE2E2Blank-4 500000000 3.04 ns/op -BenchmarkConvT2Ezero/zero/16-4 100000000 10.9 ns/op -BenchmarkConvT2Ezero/zero/32-4 100000000 10.5 ns/op -BenchmarkConvT2Ezero/zero/64-4 100000000 10.5 ns/op -BenchmarkConvT2Ezero/zero/str-4 100000000 11.9 ns/op -BenchmarkConvT2Ezero/zero/slice-4 100000000 12.8 ns/op -BenchmarkConvT2Ezero/zero/big-4 2000000 715 ns/op -BenchmarkConvT2Ezero/nonzero/16-4 30000000 52.6 ns/op -BenchmarkConvT2Ezero/nonzero/32-4 20000000 61.4 ns/op -BenchmarkConvT2Ezero/nonzero/64-4 20000000 73.1 ns/op -BenchmarkConvT2Ezero/nonzero/str-4 10000000 128 ns/op -BenchmarkConvT2Ezero/nonzero/slice-4 10000000 160 ns/op -BenchmarkConvT2Ezero/nonzero/big-4 2000000 722 ns/op -BenchmarkMalloc8-4 20000000 67.4 ns/op -BenchmarkMalloc16-4 20000000 102 ns/op -BenchmarkMallocTypeInfo8-4 20000000 99.4 ns/op -BenchmarkMallocTypeInfo16-4 20000000 119 ns/op -BenchmarkMallocLargeStruct-4 1000000 1034 ns/op -BenchmarkGoroutineSelect-4 200 5243015 ns/op -BenchmarkGoroutineBlocking-4 200 6219647 ns/op -BenchmarkGoroutineForRange-4 200 6146714 ns/op -BenchmarkGoroutineIdle-4 500 2738542 ns/op -BenchmarkHashStringSpeed-4 20000000 75.0 ns/op -BenchmarkHashBytesSpeed-4 20000000 123 ns/op -BenchmarkHashInt32Speed-4 30000000 64.2 ns/op -BenchmarkHashInt64Speed-4 20000000 56.2 ns/op -BenchmarkHashStringArraySpeed-4 10000000 175 ns/op -BenchmarkMegMap-4 30000000 51.4 ns/op -BenchmarkMegOneMap-4 100000000 21.8 ns/op -BenchmarkMegEqMap-4 5000 378562 ns/op -BenchmarkMegEmptyMap-4 200000000 9.83 ns/op -BenchmarkSmallStrMap-4 30000000 53.3 ns/op -BenchmarkMapStringKeysEight_16-4 30000000 48.8 ns/op -BenchmarkMapStringKeysEight_32-4 30000000 47.0 ns/op -BenchmarkMapStringKeysEight_64-4 30000000 47.0 ns/op -BenchmarkMapStringKeysEight_1M-4 30000000 47.3 ns/op -BenchmarkIntMap-4 30000000 47.9 ns/op -BenchmarkMapFirst/1-4 100000000 15.4 ns/op -BenchmarkMapFirst/2-4 100000000 15.6 ns/op -BenchmarkMapFirst/3-4 100000000 15.6 ns/op -BenchmarkMapFirst/4-4 100000000 15.6 ns/op -BenchmarkMapFirst/5-4 100000000 15.6 ns/op -BenchmarkMapFirst/6-4 100000000 15.4 ns/op -BenchmarkMapFirst/7-4 100000000 15.6 ns/op -BenchmarkMapFirst/8-4 100000000 15.4 ns/op -BenchmarkMapFirst/9-4 50000000 35.2 ns/op -BenchmarkMapFirst/10-4 50000000 35.4 ns/op -BenchmarkMapFirst/11-4 50000000 35.1 ns/op -BenchmarkMapFirst/12-4 50000000 35.1 ns/op -BenchmarkMapFirst/13-4 50000000 35.1 ns/op -BenchmarkMapFirst/14-4 50000000 35.1 ns/op -BenchmarkMapFirst/15-4 50000000 35.1 ns/op -BenchmarkMapFirst/16-4 50000000 35.1 ns/op -BenchmarkMapMid/1-4 100000000 16.1 ns/op -BenchmarkMapMid/2-4 100000000 19.0 ns/op -BenchmarkMapMid/3-4 100000000 19.1 ns/op -BenchmarkMapMid/4-4 100000000 21.3 ns/op -BenchmarkMapMid/5-4 100000000 21.1 ns/op -BenchmarkMapMid/6-4 100000000 23.2 ns/op -BenchmarkMapMid/7-4 100000000 23.2 ns/op -BenchmarkMapMid/8-4 50000000 25.6 ns/op -BenchmarkMapMid/9-4 30000000 40.0 ns/op -BenchmarkMapMid/10-4 30000000 55.1 ns/op -BenchmarkMapMid/11-4 30000000 46.0 ns/op -BenchmarkMapMid/12-4 30000000 46.0 ns/op -BenchmarkMapMid/13-4 30000000 46.0 ns/op -BenchmarkMapMid/14-4 50000000 46.0 ns/op -BenchmarkMapMid/15-4 30000000 40.0 ns/op -BenchmarkMapMid/16-4 50000000 46.4 ns/op -BenchmarkMapLast/1-4 100000000 16.1 ns/op -BenchmarkMapLast/2-4 100000000 19.0 ns/op -BenchmarkMapLast/3-4 100000000 21.1 ns/op -BenchmarkMapLast/4-4 50000000 23.2 ns/op -BenchmarkMapLast/5-4 50000000 25.3 ns/op -BenchmarkMapLast/6-4 50000000 27.4 ns/op -BenchmarkMapLast/7-4 50000000 29.6 ns/op -BenchmarkMapLast/8-4 30000000 47.4 ns/op -BenchmarkMapLast/9-4 30000000 52.1 ns/op -BenchmarkMapLast/10-4 30000000 56.8 ns/op -BenchmarkMapLast/11-4 30000000 56.9 ns/op -BenchmarkMapLast/12-4 30000000 55.6 ns/op -BenchmarkMapLast/13-4 20000000 55.1 ns/op -BenchmarkMapLast/14-4 20000000 51.9 ns/op -BenchmarkMapLast/15-4 30000000 48.4 ns/op -BenchmarkMapLast/16-4 30000000 48.4 ns/op -BenchmarkMapCycle-4 20000000 80.9 ns/op -BenchmarkRepeatedLookupStrMapKey32-4 20000000 76.9 ns/op -BenchmarkRepeatedLookupStrMapKey1M-4 5000 241809 ns/op -BenchmarkMakeMap/[Byte]Byte-4 5000000 378 ns/op -BenchmarkMakeMap/[Int]Int-4 3000000 586 ns/op -BenchmarkNewEmptyMap-4 50000000 25.3 ns/op 0 B/op 0 allocs/op -BenchmarkNewSmallMap-4 10000000 152 ns/op 0 B/op 0 allocs/op -BenchmarkMapIter-4 5000000 323 ns/op -BenchmarkMapIterEmpty-4 100000000 22.5 ns/op -BenchmarkSameLengthMap-4 100000000 18.3 ns/op -BenchmarkBigKeyMap-4 20000000 95.4 ns/op -BenchmarkBigValMap-4 20000000 95.5 ns/op -BenchmarkSmallKeyMap-4 20000000 66.7 ns/op -BenchmarkMapPopulate/1-4 20000000 83.6 ns/op 0 B/op 0 allocs/op -BenchmarkMapPopulate/10-4 1000000 1953 ns/op 179 B/op 1 allocs/op -BenchmarkMapPopulate/100-4 50000 25432 ns/op 3252 B/op 15 allocs/op -BenchmarkMapPopulate/1000-4 5000 279914 ns/op 49383 B/op 19 allocs/op -BenchmarkMapPopulate/10000-4 500 2723038 ns/op 412217 B/op 163 allocs/op -BenchmarkMapPopulate/100000-4 50 28713410 ns/op 3588881 B/op 3733 allocs/op -BenchmarkComplexAlgMap-4 10000000 214 ns/op -BenchmarkGoMapClear/Reflexive/1-4 20000000 112 ns/op -BenchmarkGoMapClear/Reflexive/10-4 10000000 123 ns/op -BenchmarkGoMapClear/Reflexive/100-4 5000000 304 ns/op -BenchmarkGoMapClear/Reflexive/1000-4 300000 3735 ns/op -BenchmarkGoMapClear/Reflexive/10000-4 50000 34074 ns/op -BenchmarkGoMapClear/NonReflexive/1-4 5000000 379 ns/op -BenchmarkGoMapClear/NonReflexive/10-4 3000000 480 ns/op -BenchmarkGoMapClear/NonReflexive/100-4 1000000 1183 ns/op -BenchmarkGoMapClear/NonReflexive/1000-4 100000 13549 ns/op -BenchmarkGoMapClear/NonReflexive/10000-4 10000 117289 ns/op -BenchmarkMapStringConversion/32/simple-4 30000000 41.9 ns/op 0 B/op 0 allocs/op -BenchmarkMapStringConversion/32/struct-4 30000000 41.9 ns/op 0 B/op 0 allocs/op -BenchmarkMapStringConversion/32/array-4 30000000 41.8 ns/op 0 B/op 0 allocs/op -BenchmarkMapStringConversion/64/simple-4 30000000 46.3 ns/op 0 B/op 0 allocs/op -BenchmarkMapStringConversion/64/struct-4 30000000 46.3 ns/op 0 B/op 0 allocs/op -BenchmarkMapStringConversion/64/array-4 30000000 46.3 ns/op 0 B/op 0 allocs/op -BenchmarkMapPop100-4 50000 36575 ns/op -BenchmarkMapPop1000-4 3000 511995 ns/op -BenchmarkMapPop10000-4 100 12112237 ns/op -BenchmarkMapAssign/Int32/256-4 20000000 66.0 ns/op -BenchmarkMapAssign/Int32/65536-4 20000000 90.2 ns/op -BenchmarkMapAssign/Int64/256-4 20000000 66.0 ns/op -BenchmarkMapAssign/Int64/65536-4 10000000 115 ns/op -BenchmarkMapAssign/Str/256-4 20000000 79.9 ns/op -BenchmarkMapAssign/Str/65536-4 10000000 186 ns/op -BenchmarkMapOperatorAssign/Int32/256-4 20000000 66.2 ns/op -BenchmarkMapOperatorAssign/Int32/65536-4 20000000 95.3 ns/op -BenchmarkMapOperatorAssign/Int64/256-4 20000000 66.7 ns/op -BenchmarkMapOperatorAssign/Int64/65536-4 10000000 138 ns/op -BenchmarkMapOperatorAssign/Str/256-4 1000000 5035 ns/op -BenchmarkMapOperatorAssign/Str/65536-4 3000000 682 ns/op -BenchmarkMapAppendAssign/Int32/256-4 20000000 96.4 ns/op 47 B/op 0 allocs/op -BenchmarkMapAppendAssign/Int32/65536-4 5000000 275 ns/op 28 B/op 0 allocs/op -BenchmarkMapAppendAssign/Int64/256-4 20000000 95.7 ns/op 47 B/op 0 allocs/op -BenchmarkMapAppendAssign/Int64/65536-4 5000000 293 ns/op 28 B/op 0 allocs/op -BenchmarkMapAppendAssign/Str/256-4 10000000 318 ns/op 93 B/op 0 allocs/op -BenchmarkMapAppendAssign/Str/65536-4 3000000 465 ns/op 48 B/op 0 allocs/op -BenchmarkMapDelete/Int32/100-4 20000000 104 ns/op -BenchmarkMapDelete/Int32/1000-4 20000000 77.8 ns/op -BenchmarkMapDelete/Int32/10000-4 20000000 103 ns/op -BenchmarkMapDelete/Int64/100-4 20000000 103 ns/op -BenchmarkMapDelete/Int64/1000-4 20000000 80.3 ns/op -BenchmarkMapDelete/Int64/10000-4 20000000 104 ns/op -BenchmarkMapDelete/Str/100-4 10000000 124 ns/op -BenchmarkMapDelete/Str/1000-4 20000000 117 ns/op -BenchmarkMapDelete/Str/10000-4 10000000 126 ns/op -BenchmarkMemmove/0-4 300000000 5.58 ns/op -BenchmarkMemmove/1-4 100000000 13.5 ns/op 74.30 MB/s -BenchmarkMemmove/2-4 100000000 13.5 ns/op 148.40 MB/s -BenchmarkMemmove/3-4 100000000 13.3 ns/op 225.03 MB/s -BenchmarkMemmove/4-4 100000000 13.3 ns/op 299.99 MB/s -BenchmarkMemmove/5-4 100000000 13.3 ns/op 374.96 MB/s -BenchmarkMemmove/6-4 100000000 13.5 ns/op 444.23 MB/s -BenchmarkMemmove/7-4 100000000 13.4 ns/op 522.62 MB/s -BenchmarkMemmove/8-4 100000000 13.3 ns/op 600.00 MB/s -BenchmarkMemmove/9-4 100000000 13.4 ns/op 673.43 MB/s -BenchmarkMemmove/10-4 100000000 13.3 ns/op 750.14 MB/s -BenchmarkMemmove/11-4 100000000 13.3 ns/op 824.91 MB/s -BenchmarkMemmove/12-4 100000000 13.3 ns/op 899.90 MB/s -BenchmarkMemmove/13-4 100000000 13.5 ns/op 962.98 MB/s -BenchmarkMemmove/14-4 100000000 13.4 ns/op 1046.19 MB/s -BenchmarkMemmove/15-4 100000000 13.3 ns/op 1124.88 MB/s -BenchmarkMemmove/16-4 100000000 13.5 ns/op 1188.13 MB/s -BenchmarkMemmove/32-4 100000000 13.6 ns/op 2356.67 MB/s -BenchmarkMemmove/64-4 100000000 16.3 ns/op 3924.55 MB/s -BenchmarkMemmove/128-4 50000000 23.9 ns/op 5354.07 MB/s -BenchmarkMemmove/256-4 50000000 35.2 ns/op 7280.74 MB/s -BenchmarkMemmove/512-4 20000000 68.1 ns/op 7522.83 MB/s -BenchmarkMemmove/1024-4 20000000 113 ns/op 9060.92 MB/s -BenchmarkMemmove/2048-4 10000000 203 ns/op 10086.84 MB/s -BenchmarkMemmove/4096-4 5000000 383 ns/op 10668.94 MB/s -BenchmarkMemmoveUnalignedDst/0-4 100000000 10.7 ns/op -BenchmarkMemmoveUnalignedDst/1-4 100000000 15.4 ns/op 64.75 MB/s -BenchmarkMemmoveUnalignedDst/2-4 100000000 14.0 ns/op 142.50 MB/s -BenchmarkMemmoveUnalignedDst/3-4 100000000 14.0 ns/op 213.78 MB/s -BenchmarkMemmoveUnalignedDst/4-4 100000000 14.5 ns/op 275.50 MB/s -BenchmarkMemmoveUnalignedDst/5-4 100000000 14.9 ns/op 335.56 MB/s -BenchmarkMemmoveUnalignedDst/6-4 100000000 14.7 ns/op 407.71 MB/s -BenchmarkMemmoveUnalignedDst/7-4 100000000 14.9 ns/op 468.79 MB/s -BenchmarkMemmoveUnalignedDst/8-4 100000000 14.5 ns/op 550.56 MB/s -BenchmarkMemmoveUnalignedDst/9-4 100000000 14.7 ns/op 611.60 MB/s -BenchmarkMemmoveUnalignedDst/10-4 100000000 15.0 ns/op 668.48 MB/s -BenchmarkMemmoveUnalignedDst/11-4 100000000 14.8 ns/op 744.55 MB/s -BenchmarkMemmoveUnalignedDst/12-4 100000000 15.1 ns/op 792.42 MB/s -BenchmarkMemmoveUnalignedDst/13-4 100000000 15.0 ns/op 866.28 MB/s -BenchmarkMemmoveUnalignedDst/14-4 100000000 14.9 ns/op 942.03 MB/s -BenchmarkMemmoveUnalignedDst/15-4 100000000 15.0 ns/op 1000.58 MB/s -BenchmarkMemmoveUnalignedDst/16-4 100000000 14.5 ns/op 1103.84 MB/s -BenchmarkMemmoveUnalignedDst/32-4 100000000 16.7 ns/op 1921.87 MB/s -BenchmarkMemmoveUnalignedDst/64-4 50000000 32.7 ns/op 1954.46 MB/s -BenchmarkMemmoveUnalignedDst/128-4 50000000 28.1 ns/op 4560.37 MB/s -BenchmarkMemmoveUnalignedDst/256-4 30000000 47.7 ns/op 5364.41 MB/s -BenchmarkMemmoveUnalignedDst/512-4 20000000 84.9 ns/op 6029.49 MB/s -BenchmarkMemmoveUnalignedDst/1024-4 10000000 156 ns/op 6552.17 MB/s -BenchmarkMemmoveUnalignedDst/2048-4 5000000 290 ns/op 7059.63 MB/s -BenchmarkMemmoveUnalignedDst/4096-4 3000000 561 ns/op 7296.37 MB/s -BenchmarkMemmoveUnalignedSrc/0-4 100000000 10.5 ns/op -BenchmarkMemmoveUnalignedSrc/1-4 100000000 15.6 ns/op 64.12 MB/s -BenchmarkMemmoveUnalignedSrc/2-4 100000000 14.0 ns/op 142.49 MB/s -BenchmarkMemmoveUnalignedSrc/3-4 100000000 14.2 ns/op 211.08 MB/s -BenchmarkMemmoveUnalignedSrc/4-4 100000000 13.9 ns/op 287.49 MB/s -BenchmarkMemmoveUnalignedSrc/5-4 100000000 13.6 ns/op 367.36 MB/s -BenchmarkMemmoveUnalignedSrc/6-4 100000000 13.9 ns/op 432.38 MB/s -BenchmarkMemmoveUnalignedSrc/7-4 100000000 13.6 ns/op 514.32 MB/s -BenchmarkMemmoveUnalignedSrc/8-4 100000000 13.8 ns/op 579.18 MB/s -BenchmarkMemmoveUnalignedSrc/9-4 100000000 14.0 ns/op 643.05 MB/s -BenchmarkMemmoveUnalignedSrc/10-4 100000000 14.0 ns/op 715.96 MB/s -BenchmarkMemmoveUnalignedSrc/11-4 100000000 13.8 ns/op 795.76 MB/s -BenchmarkMemmoveUnalignedSrc/12-4 100000000 14.0 ns/op 855.35 MB/s -BenchmarkMemmoveUnalignedSrc/13-4 100000000 14.0 ns/op 930.87 MB/s -BenchmarkMemmoveUnalignedSrc/14-4 100000000 14.0 ns/op 998.89 MB/s -BenchmarkMemmoveUnalignedSrc/15-4 100000000 14.0 ns/op 1072.50 MB/s -BenchmarkMemmoveUnalignedSrc/16-4 100000000 14.0 ns/op 1141.96 MB/s -BenchmarkMemmoveUnalignedSrc/32-4 100000000 15.4 ns/op 2072.73 MB/s -BenchmarkMemmoveUnalignedSrc/64-4 100000000 18.5 ns/op 3450.95 MB/s -BenchmarkMemmoveUnalignedSrc/128-4 50000000 25.6 ns/op 4996.57 MB/s -BenchmarkMemmoveUnalignedSrc/256-4 50000000 37.9 ns/op 6754.79 MB/s -BenchmarkMemmoveUnalignedSrc/512-4 20000000 74.0 ns/op 6919.73 MB/s -BenchmarkMemmoveUnalignedSrc/1024-4 20000000 119 ns/op 8554.12 MB/s -BenchmarkMemmoveUnalignedSrc/2048-4 10000000 206 ns/op 9940.15 MB/s -BenchmarkMemmoveUnalignedSrc/4096-4 5000000 385 ns/op 10629.02 MB/s -BenchmarkMemclr/5-4 100000000 14.7 ns/op 339.27 MB/s -BenchmarkMemclr/16-4 100000000 14.9 ns/op 1075.74 MB/s -BenchmarkMemclr/64-4 100000000 20.0 ns/op 3192.24 MB/s -BenchmarkMemclr/256-4 50000000 34.7 ns/op 7373.17 MB/s -BenchmarkMemclr/4096-4 5000000 288 ns/op 14199.71 MB/s -BenchmarkMemclr/65536-4 200000 5920 ns/op 11069.74 MB/s -BenchmarkMemclr/1M-4 10000 119686 ns/op 8761.04 MB/s -BenchmarkMemclr/4M-4 3000 492651 ns/op 8513.73 MB/s -BenchmarkMemclr/8M-4 2000 978378 ns/op 8573.99 MB/s -BenchmarkMemclr/16M-4 1000 1960626 ns/op 8557.07 MB/s -BenchmarkMemclr/64M-4 200 7860433 ns/op 8537.55 MB/s -BenchmarkGoMemclr/5-4 200000000 8.66 ns/op 577.65 MB/s -BenchmarkGoMemclr/16-4 200000000 7.03 ns/op 2277.18 MB/s -BenchmarkGoMemclr/64-4 100000000 13.3 ns/op 4810.16 MB/s -BenchmarkGoMemclr/256-4 50000000 31.5 ns/op 8122.27 MB/s -BenchmarkClearFat8-4 2000000000 1.40 ns/op -BenchmarkClearFat12-4 2000000000 1.40 ns/op -BenchmarkClearFat16-4 2000000000 1.40 ns/op -BenchmarkClearFat24-4 2000000000 1.40 ns/op -BenchmarkClearFat32-4 2000000000 1.42 ns/op -BenchmarkClearFat40-4 2000000000 1.40 ns/op -BenchmarkClearFat48-4 2000000000 1.40 ns/op -BenchmarkClearFat56-4 2000000000 1.40 ns/op -BenchmarkClearFat64-4 2000000000 1.40 ns/op -BenchmarkClearFat128-4 2000000000 1.40 ns/op -BenchmarkClearFat256-4 2000000000 1.40 ns/op -BenchmarkClearFat512-4 2000000000 1.40 ns/op -BenchmarkClearFat1024-4 2000000000 1.42 ns/op -BenchmarkCopyFat8-4 2000000000 1.40 ns/op -BenchmarkCopyFat12-4 2000000000 1.40 ns/op -BenchmarkCopyFat16-4 2000000000 1.40 ns/op -BenchmarkCopyFat24-4 2000000000 1.40 ns/op -BenchmarkCopyFat32-4 2000000000 1.40 ns/op -BenchmarkCopyFat64-4 2000000000 1.40 ns/op -BenchmarkCopyFat128-4 2000000000 1.42 ns/op -BenchmarkCopyFat256-4 2000000000 1.41 ns/op -BenchmarkCopyFat512-4 2000000000 1.40 ns/op -BenchmarkCopyFat520-4 2000000000 1.40 ns/op -BenchmarkCopyFat1024-4 2000000000 1.40 ns/op -BenchmarkIssue18740-4 100000 14531 ns/op -BenchmarkFinalizer-4 500 2526732 ns/op -BenchmarkFinalizerRun-4 1000000 2604 ns/op -BenchmarkSyscall-4 20000000 63.4 ns/op -BenchmarkSyscallWork-4 20000000 96.9 ns/op -BenchmarkSyscallExcess-4 20000000 63.4 ns/op -BenchmarkSyscallExcessWork-4 20000000 96.8 ns/op -BenchmarkPingPongHog-4 500000 2889 ns/op -BenchmarkStackGrowth-4 100000000 21.2 ns/op -BenchmarkStackGrowthDeep-4 500000 2548 ns/op -BenchmarkCreateGoroutines-4 1000000 1046 ns/op -BenchmarkCreateGoroutinesParallel-4 10000000 198 ns/op -BenchmarkCreateGoroutinesCapture-4 200000 8941 ns/op 16 B/op 1 allocs/op -BenchmarkClosureCall-4 300000000 5.80 ns/op -BenchmarkWakeupParallelSpinning/0s-4 100000 20843 ns/op -BenchmarkWakeupParallelSpinning/1µs-4 50000 23993 ns/op -BenchmarkWakeupParallelSpinning/2µs-4 50000 27880 ns/op -BenchmarkWakeupParallelSpinning/5µs-4 50000 37540 ns/op -BenchmarkWakeupParallelSpinning/10µs-4 30000 56729 ns/op -BenchmarkWakeupParallelSpinning/20µs-4 20000 96465 ns/op -BenchmarkWakeupParallelSpinning/50µs-4 10000 221160 ns/op -BenchmarkWakeupParallelSpinning/100µs-4 5000 359871 ns/op -BenchmarkWakeupParallelSyscall/0s-4 10000 321507 ns/op -BenchmarkWakeupParallelSyscall/1µs-4 5000 335555 ns/op -BenchmarkWakeupParallelSyscall/2µs-4 5000 346055 ns/op -BenchmarkWakeupParallelSyscall/5µs-4 5000 343007 ns/op -BenchmarkWakeupParallelSyscall/10µs-4 5000 386787 ns/op -BenchmarkWakeupParallelSyscall/20µs-4 5000 387292 ns/op -BenchmarkWakeupParallelSyscall/50µs-4 5000 556090 ns/op -BenchmarkWakeupParallelSyscall/100µs-4 3000 626904 ns/op -BenchmarkMatmult-4 200000000 9.45 ns/op -BenchmarkFastrand-4 2000000000 1.65 ns/op -BenchmarkFastrandHashiter-4 50000000 32.3 ns/op -BenchmarkFastrandn/2-4 200000000 8.42 ns/op -BenchmarkFastrandn/3-4 200000000 8.43 ns/op -BenchmarkFastrandn/4-4 200000000 8.50 ns/op -BenchmarkFastrandn/5-4 200000000 8.42 ns/op -BenchmarkIfaceCmp100-4 5000000 370 ns/op -BenchmarkIfaceCmpNil100-4 10000000 203 ns/op -BenchmarkEfaceCmpDiff-4 1000000 2052 ns/op -BenchmarkDefer-4 5000000 256 ns/op -BenchmarkDefer10-4 10000000 230 ns/op -BenchmarkDeferMany-4 3000000 489 ns/op -BenchmarkRWMutexUncontended-4 20000000 112 ns/op -BenchmarkRWMutexWrite100-4 10000000 197 ns/op -BenchmarkRWMutexWrite10-4 1000000 1629 ns/op -BenchmarkRWMutexWorkWrite100-4 10000000 221 ns/op -BenchmarkRWMutexWorkWrite10-4 1000000 1314 ns/op -BenchmarkMakeSlice/Byte-4 20000000 60.2 ns/op -BenchmarkMakeSlice/Int16-4 20000000 73.2 ns/op -BenchmarkMakeSlice/Int-4 10000000 133 ns/op -BenchmarkMakeSlice/Ptr-4 10000000 188 ns/op -BenchmarkMakeSlice/Struct/24-4 10000000 200 ns/op -BenchmarkMakeSlice/Struct/32-4 10000000 230 ns/op -BenchmarkMakeSlice/Struct/40-4 5000000 262 ns/op -BenchmarkGrowSlice/Byte-4 10000000 144 ns/op -BenchmarkGrowSlice/Int16-4 10000000 204 ns/op -BenchmarkGrowSlice/Int-4 5000000 245 ns/op -BenchmarkGrowSlice/Ptr-4 5000000 365 ns/op -BenchmarkGrowSlice/Struct/24-4 3000000 428 ns/op -BenchmarkGrowSlice/Struct/32-4 3000000 486 ns/op -BenchmarkGrowSlice/Struct/40-4 2000000 607 ns/op -BenchmarkExtendSlice/IntSlice-4 10000000 165 ns/op -BenchmarkExtendSlice/PointerSlice-4 10000000 213 ns/op -BenchmarkExtendSlice/NoGrow-4 100000000 15.4 ns/op -BenchmarkAppend-4 30000000 56.2 ns/op -BenchmarkAppendGrowByte-4 300 5560036 ns/op -BenchmarkAppendGrowString-4 5 226765389 ns/op -BenchmarkAppendSlice/1Bytes-4 100000000 12.6 ns/op -BenchmarkAppendSlice/4Bytes-4 100000000 12.0 ns/op -BenchmarkAppendSlice/7Bytes-4 100000000 11.9 ns/op -BenchmarkAppendSlice/8Bytes-4 100000000 12.0 ns/op -BenchmarkAppendSlice/15Bytes-4 100000000 11.9 ns/op -BenchmarkAppendSlice/16Bytes-4 100000000 12.3 ns/op -BenchmarkAppendSlice/32Bytes-4 100000000 12.6 ns/op -BenchmarkAppendSliceLarge/1024Bytes-4 1000000 1420 ns/op -BenchmarkAppendSliceLarge/4096Bytes-4 300000 4643 ns/op -BenchmarkAppendSliceLarge/16384Bytes-4 100000 13584 ns/op -BenchmarkAppendSliceLarge/65536Bytes-4 50000 32999 ns/op -BenchmarkAppendSliceLarge/262144Bytes-4 10000 120741 ns/op -BenchmarkAppendSliceLarge/1048576Bytes-4 2000 679068 ns/op -BenchmarkAppendStr/1Bytes-4 100000000 13.5 ns/op -BenchmarkAppendStr/4Bytes-4 100000000 11.9 ns/op -BenchmarkAppendStr/8Bytes-4 100000000 11.9 ns/op -BenchmarkAppendStr/16Bytes-4 100000000 12.6 ns/op -BenchmarkAppendStr/32Bytes-4 100000000 14.4 ns/op -BenchmarkAppendSpecialCase-4 20000000 85.0 ns/op -BenchmarkCopy/1Byte-4 100000000 14.0 ns/op 71.25 MB/s -BenchmarkCopy/1String-4 100000000 13.8 ns/op 72.29 MB/s -BenchmarkCopy/2Byte-4 100000000 21.4 ns/op 93.67 MB/s -BenchmarkCopy/2String-4 100000000 17.1 ns/op 117.24 MB/s -BenchmarkCopy/4Byte-4 100000000 16.9 ns/op 237.34 MB/s -BenchmarkCopy/4String-4 100000000 16.8 ns/op 237.50 MB/s -BenchmarkCopy/8Byte-4 100000000 22.9 ns/op 348.61 MB/s -BenchmarkCopy/8String-4 100000000 16.8 ns/op 475.00 MB/s -BenchmarkCopy/12Byte-4 100000000 16.8 ns/op 712.43 MB/s -BenchmarkCopy/12String-4 100000000 16.9 ns/op 712.04 MB/s -BenchmarkCopy/16Byte-4 50000000 24.8 ns/op 646.37 MB/s -BenchmarkCopy/16String-4 100000000 16.8 ns/op 949.90 MB/s -BenchmarkCopy/32Byte-4 100000000 16.3 ns/op 1964.35 MB/s -BenchmarkCopy/32String-4 100000000 16.4 ns/op 1956.17 MB/s -BenchmarkCopy/128Byte-4 50000000 27.4 ns/op 4676.48 MB/s -BenchmarkCopy/128String-4 50000000 27.4 ns/op 4676.64 MB/s -BenchmarkCopy/1024Byte-4 20000000 113 ns/op 9005.87 MB/s -BenchmarkCopy/1024String-4 20000000 113 ns/op 9004.83 MB/s -BenchmarkAppendInPlace/NoGrow/Byte-4 1000000 1352 ns/op -BenchmarkAppendInPlace/NoGrow/1Ptr-4 300000 4058 ns/op -BenchmarkAppendInPlace/NoGrow/2Ptr-4 200000 7520 ns/op -BenchmarkAppendInPlace/NoGrow/3Ptr-4 200000 8608 ns/op -BenchmarkAppendInPlace/NoGrow/4Ptr-4 100000 14133 ns/op -BenchmarkAppendInPlace/Grow/Byte-4 1000000 1076 ns/op -BenchmarkAppendInPlace/Grow/1Ptr-4 1000000 1074 ns/op -BenchmarkAppendInPlace/Grow/2Ptr-4 1000000 1449 ns/op -BenchmarkAppendInPlace/Grow/3Ptr-4 1000000 1841 ns/op -BenchmarkAppendInPlace/Grow/4Ptr-4 1000000 1983 ns/op -BenchmarkStackCopyPtr-4 5 309390029 ns/op -BenchmarkStackCopy-4 5 297313618 ns/op -BenchmarkStackCopyNoCache-4 2 518883532 ns/op -BenchmarkCompareStringEqual-4 100000000 12.8 ns/op -BenchmarkCompareStringIdentical-4 100000000 11.9 ns/op -BenchmarkCompareStringSameLength-4 100000000 10.5 ns/op -BenchmarkCompareStringDifferentLength-4 2000000000 1.40 ns/op -BenchmarkCompareStringBigUnaligned-4 3000 430422 ns/op 2436.18 MB/s -BenchmarkCompareStringBig-4 3000 428766 ns/op 2445.59 MB/s -BenchmarkConcatStringAndBytes-4 20000000 78.6 ns/op -BenchmarkSliceByteToString/1-4 100000000 16.9 ns/op -BenchmarkSliceByteToString/2-4 20000000 65.6 ns/op -BenchmarkSliceByteToString/4-4 20000000 73.4 ns/op -BenchmarkSliceByteToString/8-4 20000000 88.1 ns/op -BenchmarkSliceByteToString/16-4 10000000 122 ns/op -BenchmarkSliceByteToString/32-4 10000000 139 ns/op -BenchmarkSliceByteToString/64-4 10000000 186 ns/op -BenchmarkSliceByteToString/128-4 5000000 281 ns/op -BenchmarkRuneCount/lenruneslice/ASCII-4 50000000 37.9 ns/op -BenchmarkRuneCount/lenruneslice/Japanese-4 5000000 263 ns/op -BenchmarkRuneCount/lenruneslice/MixedLength-4 10000000 232 ns/op -BenchmarkRuneCount/rangeloop/ASCII-4 50000000 33.0 ns/op -BenchmarkRuneCount/rangeloop/Japanese-4 5000000 260 ns/op -BenchmarkRuneCount/rangeloop/MixedLength-4 10000000 208 ns/op -BenchmarkRuneCount/utf8.RuneCountInString/ASCII-4 30000000 41.4 ns/op -BenchmarkRuneCount/utf8.RuneCountInString/Japanese-4 10000000 184 ns/op -BenchmarkRuneCount/utf8.RuneCountInString/MixedLength-4 10000000 218 ns/op -BenchmarkRuneIterate/range/ASCII-4 50000000 29.5 ns/op -BenchmarkRuneIterate/range/Japanese-4 5000000 246 ns/op -BenchmarkRuneIterate/range/MixedLength-4 10000000 206 ns/op -BenchmarkRuneIterate/range1/ASCII-4 50000000 29.5 ns/op -BenchmarkRuneIterate/range1/Japanese-4 5000000 246 ns/op -BenchmarkRuneIterate/range1/MixedLength-4 10000000 221 ns/op -BenchmarkRuneIterate/range2/ASCII-4 50000000 29.5 ns/op -BenchmarkRuneIterate/range2/Japanese-4 5000000 246 ns/op -BenchmarkRuneIterate/range2/MixedLength-4 10000000 204 ns/op -BenchmarkArrayEqual-4 200000000 6.33 ns/op -BenchmarkClockVDSOAndFallbackPaths/vDSO-4 10000000 195 ns/op -BenchmarkClockVDSOAndFallbackPaths/Fallback-4 1000000 1936 ns/op -BenchmarkTimeNow-4 10000000 197 ns/op -PASS -ok runtime 1331.420s -``` - ---Abishek Muthian ([@heavyinfo](https://twitter.com/heavyinfo)) - -## Apple silicon - -Cross-compiling Go applications - -Host/Build: macOS/x86_64 -Target: macOS/arm64 -On host machine: - -Xcode: Install latest Xcode which supports Apple silicon - -Go: Install go*.darwin-amd64.pkg (or build go from source) on macOS/x86_64 - -Set go executable in PATH - -Export the following environment variables before cross compiling go apps for macOS/arm64 - - export SDK_NAME=macosx - export SDK_PATH=$(xcrun --show-sdk-path --sdk $SDK_NAME) - export CGO_ENABLED=1 - export GOOS=darwin - export GOARCH=arm64 - export CC="$(xcrun -sdk $SDK_PATH --find clang) -arch $GOARCH -isysroot $SDK_PATH" - export CFLAGS="-isysroot $SDK_PATH -arch $GOARCH -I$SDK_PATH/usr/include" - export LD_LIBRARY_PATH="$SDK_PATH/usr/lib" - export CGO_CFLAGS="-isysroot $SDK_PATH -arch $GOARCH" - export CGO_LDFLAGS="-isysroot $SDK_PATH -arch $GOARCH" - Compile the app as below: - $ GOOS=darwin GOARCH=arm64 go build - - Copy the generated arm64 executable to target machine (macOS/arm64) and run diff --git a/GoForCPPProgrammers.md b/GoForCPPProgrammers.md index 3c41c204..549f5928 100644 --- a/GoForCPPProgrammers.md +++ b/GoForCPPProgrammers.md @@ -1,683 +1,4 @@ -Go is a systems programming language intended to be a general-purpose systems language, like C++. These are some notes on Go for experienced C++ programmers. This document discusses the differences between Go and C++, and says little to nothing about the similarities. +The Go wiki on GitHub has moved to go.dev (#61940). -An important point to keep in mind is that there are some fundamental differences in the thought processes required to be proficient in the two respective languages. Most formidably, C++'s object model is based on classes and class hierarchies while Go's object model is based on interfaces (and is essentially flat). Consequently, C++ design patterns rarely translate verbatim to Go. To program effectively in Go, one has to consider the _problem_ being solved, not the mechanisms one might use in C++ to solve the problem. +Try or . -For a more general introduction to Go, see the Go Tour, How to Write Go Code and Effective Go. - -For a detailed description of the Go language, see the Go spec. - -

Conceptual Differences

- -
    -
  • Go does not have classes with constructors or destructors. Instead of class methods, a class inheritance hierarchy, and virtual functions, Go provides interfaces, which are discussed in more detail below. Interfaces are also used where C++ uses templates.
  • - -
  • Go provides automatic garbage collection of allocated memory. It is not necessary (or possible) to release memory explicitly. There is no need to worry about heap-allocated vs. stack-allocated storage, new vs. malloc, or delete vs. delete[] vs. free. There is no need to separately manage std::unique_ptr, std::shared_ptr, std::weak_ptr, std::auto_ptr, and ordinary, non-smart "raw" pointers. Go's run-time system handles all of that error-prone code on the programmer's behalf.
  • - -
  • Go has pointers but not pointer arithmetic. Go pointers therefore more closely resemble C++ references. One cannot use a Go pointer variable to walk through the bytes of a string. Slices, discussed further below, satisfy most of the need for pointer arithmetic.
  • - -
  • Go is "safe" by default. Pointers cannot point to arbitrary memory, and buffer overruns result in crashes, not security exploits. The unsafe package lets programmers bypass some of Go's protection mechanisms where explicitly requested.
  • - -
  • Arrays in Go are first class values. When an array is used as a function parameter, the function receives a copy of the array, not a pointer to it. However, in practice functions often use slices for parameters; slices hold pointers to underlying arrays. Slices are discussed further below.
  • - -
  • Strings are provided by the language. They may not be changed once they have been created.
  • - -
  • Hash tables are provided by the language. They are called maps.
  • - -
  • Separate threads of execution, and communication channels between them, are provided by the language. This is discussed further below.
  • - -
  • Certain types (maps and channels, described further below) are passed by reference, not by value. That is, passing a map to a function does not copy the map, and if the function changes the map the change will be seen by the caller. In C++ terms, one can think of these as being reference types.
  • - -
  • Go does not use header files. Instead, each source file is part of a defined package. When a package defines an object (type, constant, variable, function) with a name starting with an upper case letter, that object is visible to any other file which imports that package.
  • - -
  • Go does not support implicit type conversion. Operations that mix different types require casts (called conversions in Go). This is true even of different user-defined aliases of the same underlying type.
  • - -
  • Go does not support function overloading and does not support user defined operators.
  • - -
  • Go does not support const or volatile qualifiers.
  • - -
  • Go uses nil for invalid pointers, where C++ uses NULL or simply 0 (or in C++11, nullptr).
  • - -
  • Idiomatic Go uses multiple return values to convey errors—one or more data results plus an error code—instead of sentinel values (e.g., -1) or structured exception handling (C++'s trycatch and throw or Go's panicrecover).
  • - -
- -

Syntax

- -The declaration syntax is reversed compared to C++. You write the name followed by the type. Unlike in C++, the syntax for a type does not match the way in which the variable is used. Type declarations may be read easily from left to right. (`var v1 int` → "Variable `v1` is an `int`.") - -```go -//Go C++ -var v1 int // int v1; -var v2 string // const std::string v2; (approximately) -var v3 [10]int // int v3[10]; -var v4 []int // int* v4; (approximately) -var v5 struct { f int } // struct { int f; } v5; -var v6 *int // int* v6; (but no pointer arithmetic) -var v7 map[string]int // unordered_map* v7; (approximately) -var v8 func(a int) int // int (*v8)(int a); -``` - -Declarations generally take the form of a keyword followed by the name of the object being declared. The keyword is one of `var`, `func`, `const`, or `type`. Method declarations are a minor exception in that the receiver appears before the name of the object being declared; see the discussion of interfaces. - -You can also use a keyword followed by a series of declarations in parentheses. - -```go -var ( - i int - m float64 -) -``` - -When declaring a function, you must either provide a name for each parameter or not provide a name for any parameter. (That is, C++ permits `void f(int i, int);`, but Go does not permit the analogous `func f(i int, int)`.) However, for convenience, in Go you may group several names with the same type: - -```go -func f(i, j, k int, s, t string) -``` - -A variable may be initialized when it is declared. When this is done, specifying the type is permitted but not required. When the type is not specified, the type of the variable is the type of the initialization expression. - -```go -var v = *p -``` - -See also the discussion of constants, below. If a variable is not initialized explicitly, the type must be specified. In that case it will be implicitly initialized to the type's zero value (`0`, `nil`, etc.). There are no uninitialized variables in Go. - -Within a function, a short declaration syntax is available with `:=` . - -```go -v1 := v2 // C++11: auto v1 = v2; -``` - -This is equivalent to - -```go -var v1 = v2 // C++11: auto v1 = v2; -``` - -Go permits multiple assignments, which are done in parallel. That is, first all of the values on the right-hand side are computed, and then these values are assigned to the variables on the left-hand side. - -```go -i, j = j, i // Swap i and j. -``` - -Functions may have multiple return values, indicated by a list in parentheses. The returned values can be stored by assignment to a list of variables. - -```go -func f() (i int, j int) { ... } -v1, v2 = f() -``` - -Multiple return values are Go's primary mechanism for error handling: - -```go -result, ok := g() -if !ok { - // Something bad happened. - return nil -} -// Continue as normal. -… -``` - -or, more tersely, - -```go -if result, ok := g(); !ok { - // Something bad happened. - return nil -} -// Continue as normal. -… -``` - -Go code uses very few semicolons in practice. Technically, all Go statements are terminated by a semicolon. However, Go treats the end of a non-blank line as a semicolon unless the line is clearly incomplete (the exact rules are in the language specification). A consequence of this is that in some cases Go does not permit you to use a line break. For example, you may not write - -```go -func g() -{ // INVALID -} -``` - -A semicolon will be inserted after `g()`, causing it to be a function declaration rather than a function definition. Similarly, you may not write - -```go -if x { -} -else { // INVALID -} -``` - -A semicolon will be inserted after the `}` preceding the `else`, causing a syntax error. - -Since semicolons do end statements, you may continue using them as in C++. However, that is not the recommended style. Idiomatic Go code omits unnecessary semicolons, which in practice is all of them other than the initial ` for ` loop clause and cases where you want several short statements on a single line. - -While we're on the topic, we recommend that rather than worry about semicolons and brace placement, you format your code with the `gofmt` program. That will produce a single standard Go style, and let you worry about your code rather than your formatting. While the style may initially seem odd, it is as good as any other style, and familiarity will lead to comfort. - -When using a pointer to a struct, you use `.` instead of `->`. Thus, syntactically speaking, a structure and a pointer to a structure are used in the same way. - -```go -type myStruct struct{ i int } -var v9 myStruct // v9 has structure type -var p9 *myStruct // p9 is a pointer to a structure -f(v9.i, p9.i) -``` - -Go does not require parentheses around the condition of an `if` statement, or the expressions of a `for` statement, or the value of a `switch` statement. On the other hand, it does require curly braces around the body of an `if` or `for` statement. - -```go -if a < b { f() } // Valid -if (a < b) { f() } // Valid (condition is a parenthesized expression) -if (a < b) f() // INVALID -for i = 0; i < 10; i++ {} // Valid -for (i = 0; i < 10; i++) {} // INVALID -``` - -Go does not have a `while` statement nor does it have a `do/while` statement. The `for` statement may be used with a single condition, which makes it equivalent to a `while` statement. Omitting the condition entirely is an endless loop. - -Go permits `break` and `continue` to specify a label. The label must refer to a `for`, `switch`, or `select` statement. - -In a `switch` statement, `case` labels do not fall through. You can make them fall through using the `fallthrough` keyword. This applies even to adjacent cases. - -```go -switch i { -case 0: // empty case body -case 1: - f() // f is not called when i == 0! -} -``` - -But a `case` can have multiple values. - -```go -switch i { -case 0, 1: - f() // f is called if i == 0 || i == 1. -} -``` - -The values in a `case` need not be constants--or even integers; any type that supports the equality comparison operator, such as strings or pointers, can be used--and if the `switch` value is omitted it defaults to `true`. - -```go -switch { -case i < 0: - f1() -case i == 0: - f2() -case i > 0: - f3() -} -``` - -The `defer` statement may be used to call a function after the function containing the `defer` statement returns. `defer` often takes the place of a destructor in C++ but is associated with the calling code, not any particular class or object. - -```go -fd := open("filename") -defer close(fd) // fd will be closed when this function returns. -``` - -

Operators

- -The `++` and `--` operators may only be used in statements, not in expressions. You cannot write `c = *p++`. `*p++` is parsed as `(*p)++`. - -The operator precedence is different. As an example `4 & 3 << 1` evaluates to `0` in Go and `4` in C++. - -``` -Go operator precedence: -1. * / % << >> & &^ -2. + - | ^ -3. == != < <= > >= -4. && -5. || -``` - -``` -C++ operator precedence (only relevant operators): -1. * / % -2. + - -3. << >> -4. < <= > >= -5. == != -6. & -7. ^ -8. | -9. && -10. || -``` - -

Constants

- -In Go constants may be untyped. This applies even to constants named with a `const` declaration, if no type is given in the declaration and the initializer expression uses only untyped constants. A value derived from an untyped constant becomes typed when it is used within a context that requires a typed value. This permits constants to be used relatively freely without requiring general implicit type conversion. - -```go -var a uint -f(a + 1) // untyped numeric constant "1" becomes typed as uint -``` - -The language does not impose any limits on the size of an untyped numeric constant or constant expression. A limit is only applied when a constant is used where a type is required. - -```go -const huge = 1 << 100 -f(huge >> 98) -``` - -Go does not support enums. Instead, you can use the special name `iota` in a single `const` declaration to get a series of increasing value. When an initialization expression is omitted for a `const`, it reuses the preceding expression. - -```go -const ( - red = iota // red == 0 - blue // blue == 1 - green // green == 2 -) -``` - -

Types

- -C++ and Go provide similar, but not identical, built-in types: signed and unsigned integers of various widths, 32-bit and 64-bit floating-point numbers (real and complex), `struct`s, pointers, etc. In Go, `uint8`, `int64`, and like-named integer types are part of the language, not built on top of integers whose sizes are implementation-dependent (e.g., `long long`). Go additionally provides native `string`, `map`, and `chan` (channel) types as well as first-class arrays and slices (described below). Strings are encoded with Unicode, not ASCII. - -Go is far more strongly typed than C++. In particular, there is no implicit type conversion in Go, only explicit type conversion. This provides additional safety and freedom from a class of bugs but at the cost of some additional typing. There is also no `union` type in Go, as this would enable subversion of the type system. However, a Go `interface{}` (see below) provides a type-safe alternative. - -Both C++ and Go support type aliases (`typedef` in C++, `type` in Go). However, unlike C++, Go treats these as different types. Hence, the following is valid in C++: - -```C++ -// C++ -typedef double position; -typedef double velocity; - -position pos = 218.0; -velocity vel = -9.8; - -pos += vel; -``` - -but the equivalent is invalid in Go without an explicit type conversion: - -```go -type position float64 -type velocity float64 - -var pos position = 218.0 -var vel velocity = -9.8 - -pos += vel // INVALID: mismatched types position and velocity -// pos += position(vel) // Valid -``` - -The same is true even for unaliased types: an `int` and a `uint` cannot be combined in an expression without explicitly converting one to the other. - -Go does not allow pointers to be cast to and from integers, unlike in C++. However, Go's `unsafe` package enables one to explicitly bypass this safety mechanism if necessary (e.g., for use in low-level systems code). - - -

Slices

- -A slice is conceptually a struct with three fields: a pointer to an array, a length, and a capacity. Slices support the `[]` operator to access elements of the underlying array. The builtin `len` function returns the length of the slice. The builtin `cap` function returns the capacity. - -Given an array, or another slice, a new slice is created via `a[i:j]`. This creates a new slice that refers to `a`, starts at index `i`, and ends before index `j`. It has length `j-i`. If `i` is omitted, the slice starts at `0`. If `j` is omitted, the slice ends at `len(a)`. The new slice refers to the same array to which `a` refers. Two implications of this statement are that ① changes made using the new slice may be seen using `a`, and ② slice creation is (intended to be) cheap; no copy needs to be made of the underlying array. The capacity of the new slice is simply the capacity of `a` minus `i`. The capacity of an array is the length of the array. - -What this means is that Go uses slices for some cases where C++ uses pointers. If you create a value of type `[100]byte` (an array of 100 bytes, perhaps a buffer) and you want to pass it to a function without copying it, you should declare the function parameter to have type `[]byte`, and pass a slice of the array (`a[:]` will pass the entire array). Unlike in C++, it is not necessary to pass the length of the buffer; it is efficiently accessible via `len`. - -The slice syntax may also be used with a string. It returns a new string, whose value is a substring of the original string. Because strings are immutable, string slices can be implemented without allocating new storage for the slices's contents. - -

Making values

- -Go has a builtin function `new` which takes a type and allocates space on the heap. The allocated space will be zero-initialized for the type. For example, `new(int)` allocates a new int on the heap, initializes it with the value `0`, and returns its address, which has type `*int`. Unlike in C++, `new` is a function, not an operator; `new int` is a syntax error. - -Perhaps surprisingly, `new` is not commonly used in Go programs. In Go taking the address of a variable is always safe and never yields a dangling pointer. If the program takes the address of a variable, it will be allocated on the heap if necessary. So these functions are equivalent: - -```go -type S struct { I int } - -func f1() *S { - return new(S) -} - -func f2() *S { - var s S - return &s -} - -func f3() *S { - // More idiomatic: use composite literal syntax. - return &S{} -} -``` - -In contrast, it is not safe in C++ to return a pointer to a local variable: - -```C++ -// C++ -S* f2() { - S s; - return &s; // INVALID -- contents can be overwritten at any time -} -``` - -Map and channel values must be allocated using the builtin function `make`. A variable declared with map or channel type without an initializer will be automatically initialized to `nil`. Calling `make(map[int]int)` returns a newly allocated value of type `map[int]int`. Note that `make` returns a value, not a pointer. This is consistent with the fact that map and channel values are passed by reference. Calling `make` with a map type takes an optional argument which is the expected capacity of the map. Calling `make` with a channel type takes an optional argument which sets the buffering capacity of the channel; the default is 0 (unbuffered). - -The `make` function may also be used to allocate a slice. In this case it allocates memory for the underlying array and returns a slice referring to it. There is one required argument, which is the number of elements in the slice. A second, optional, argument is the capacity of the slice. For example, `make([]int, 10, 20)`. This is identical to `new([20]int)[0:10]`. Since Go uses garbage collection, the newly allocated array will be discarded sometime after there are no references to the returned slice. - -

Interfaces

- -Where C++ provides classes, subclasses and templates, Go provides interfaces. A Go interface is similar to a C++ pure abstract class: a class with no data members, with methods which are all pure virtual. However, in Go, any type which provides the methods named in the interface may be treated as an implementation of the interface. No explicitly declared inheritance is required. The implementation of the interface is entirely separate from the interface itself. - -A method looks like an ordinary function definition, except that it has a receiver. The receiver is similar to the `this` pointer in a C++ class method. - -```go -type myType struct{ i int } - -func (p *myType) Get() int { return p.i } -``` - -This declares a method `Get` associated with `myType`. The receiver is named `p` in the body of the function. - -Methods are defined on named types. If you convert the value to a different type, the new value will have the methods of the new type, -not the old type. - -You may define methods on a builtin type by declaring a new named type derived from it. The new type is distinct from the builtin type. - -```go -type myInteger int - -func (p myInteger) Get() int { return int(p) } // Conversion required. -func f(i int) {} - -var v myInteger - -// f(v) is invalid. -// f(int(v)) is valid; int(v) has no defined methods. -``` - -Given this interface: - -```go -type myInterface interface { - Get() int - Set(i int) -} -``` - -we can make `myType` satisfy the interface by adding - -```go -func (p *myType) Set(i int) { p.i = i } -``` - -Now any function which takes `myInterface` as a parameter will accept a variable of type `*myType`. - -```go -func GetAndSet(x myInterface) {} -func f1() { - var p myType - GetAndSet(&p) -} -``` - -In other words, if we view `myInterface` as a C++ pure abstract base class, defining `Set` and `Get` for `*myType` made `*myType` automatically inherit from `myInterface`. A type may satisfy multiple interfaces. - -An anonymous field may be used to implement something much like a C++ child class. - -```go -type myChildType struct { - myType - j int -} - -func (p *myChildType) Get() int { p.j++; return p.myType.Get() } -``` - -This effectively implements `myChildType` as a child of `myType`. - -```go -func f2() { - var p myChildType - GetAndSet(&p) -} -``` - -The `Set` method is effectively inherited from `myType`, because methods associated with the anonymous field are promoted to become methods of the enclosing type. In this case, because `myChildType` has an anonymous field of type `myType`, the methods of `myType` also become methods of `myChildType`. In this example, the `Get` method was overridden, and the `Set` method was inherited. - -This is not precisely the same as a child class in C++. When a method of an anonymous field is called, its receiver is the field, not the surrounding struct. In other words, methods on anonymous fields are not virtual functions. When you want the equivalent of a virtual function, use an interface. - -A variable that has an interface type may be converted to have a different interface type using a special construct called a type assertion. This is implemented dynamically at run time, like C++ `dynamic_cast`. Unlike `dynamic_cast`, there does not need to be any declared relationship between the two interfaces. - -```go -type myPrintInterface interface { - Print() -} - -func f3(x myInterface) { - x.(myPrintInterface).Print() // type assertion to myPrintInterface -} -``` - -The conversion to `myPrintInterface` is entirely dynamic. It will work as long as the dynamic type of x defines a `Print` method. - -Because the conversion is dynamic, it may be used to implement generic programming similar to templates in C++. This is done by manipulating values of the minimal interface. - -```go -type Any interface{} -``` - -Containers may be written in terms of `Any`, but the caller must unbox using a type assertion to recover values of the contained type. As the typing is dynamic rather than static, there is no equivalent of the way that a C++ template may inline the relevant operations. The operations are fully type-checked at run time, but all operations will involve a function call. - -```go -type Iterator interface { - Get() Any - Set(v Any) - Increment() - Equal(arg Iterator) bool -} -``` - -Note that `Equal` has an argument of type `Iterator`. This does not behave like a C++ template. See the FAQ. - -

Function closures

- -In C++ versions prior to C++11, the most common way to create a function with hidden state is to use a "functor"—a class that overloads `operator()` to make instances look like functions. For example, the following code defines a `my_transform` function (a simplified version of the STL's `std::transform`) that applies a given unary operator (`op`) to each element of an array (`in`), storing the result in another array (`out`). To implement a prefix sum (i.e., {`x[0]`, `x[0]+x[1]`, `x[0]+x[1]+x[2]`, …}) the code creates a functor (`MyFunctor`) that keeps track of the running total (`total`) and passes an instance of this functor to `my_transform`. - -```C++ -// C++ -#include -#include - -template -void my_transform (size_t n_elts, int* in, int* out, UnaryOperator op) -{ - size_t i; - - for (i = 0; i < n_elts; i++) - out[i] = op(in[i]); -} - -class MyFunctor { -public: - int total; - int operator()(int v) { - total += v; - return total; - } - MyFunctor() : total(0) {} -}; - -int main (void) -{ - int data[7] = {8, 6, 7, 5, 3, 0, 9}; - int result[7]; - MyFunctor accumulate; - my_transform(7, data, result, accumulate); - - std::cout << "Result is [ "; - for (size_t i = 0; i < 7; i++) - std::cout << result[i] << ' '; - std::cout << "]\n"; - return 0; -} -``` - -C++11 adds anonymous ("lambda") functions, which can be stored in variables and passed to functions. They can optionally serve as closures, meaning they can reference state from parent scopes. This feature greatly simplifies `my_transform`: - -```C++ -// C++11 -#include -#include -#include - -void my_transform (size_t n_elts, int* in, int* out, std::function op) -{ - size_t i; - - for (i = 0; i < n_elts; i++) - out[i] = op(in[i]); -} - -int main (void) -{ - int data[7] = {8, 6, 7, 5, 3, 0, 9}; - int result[7]; - int total = 0; - my_transform(7, data, result, [&total] (int v) { - total += v; - return total; - }); - - std::cout << "Result is [ "; - for (size_t i = 0; i < 7; i++) - std::cout << result[i] << ' '; - std::cout << "]\n"; - return 0; -} -``` - -A typical Go version of `my_transform` looks a lot like the C++11 version: - -```go -package main - -import "fmt" - -func my_transform(in []int, xform func(int) int) (out []int) { - out = make([]int, len(in)) - for idx, val := range in { - out[idx] = xform(val) - } - return -} - -func main() { - data := []int{8, 6, 7, 5, 3, 0, 9} - total := 0 - fmt.Printf("Result is %v\n", my_transform(data, func(v int) int { - total += v - return total - })) -} -``` - -(Note that we chose to return `out` from `my_transform` rather than pass it an `out` to write to. This was an aesthetic decision; the code could have been written more like the C++ version in that regard.) - -In Go, functions are always full closures, the equivalent of `[&]` in C++11. An important difference is that it is invalid in C++11 for a closure to reference a variable whose scope has gone away (as may be caused by an upward funarg—a function that returns a lambda that references local variables). In Go, this is perfectly valid. - - -

Concurrency

- -Like C++11's `std::thread`, Go permits starting new threads of execution that run concurrently in a shared address space. These are called _goroutines_ and are spawned using the `go` statement. While typical `std::thread` implementations launch heavyweight, operating-system threads, goroutines are implemented as lightweight, user-level threads that are multiplexed among multiple operating-system threads. Consequently, goroutines are (intended to be) cheap and can be used liberally throughout a program. - -```go -func server(i int) { - for { - fmt.Print(i) - time.Sleep(10 * time.Second) - } -} -go server(1) -go server(2) -``` - -(Note that the `for` statement in the `server` function is equivalent to a C++ `while (true)` loop.) - -Function literals (which Go implements as closures) can be useful with the `go` statement. - -```go -var g int -go func(i int) { - s := 0 - for j := 0; j < i; j++ { - s += j - } - g = s -}(1000) // Passes argument 1000 to the function literal. -``` - -Like C++11, but unlike prior versions of C++, Go defines a memory model for unsynchronized accesses to memory. Although Go provides an analogue of `std::mutex` in its ` sync ` package, this is not the normal way to implement inter-thread communication and synchronization in Go programs. Instead, Go threads more typically communicate by message passing, which is a fundamentally different approach from locks and barriers. The Go mantra for this subject is, - -> Do not communicate by sharing memory; instead, share memory by communicating. - -That is, _channels_ are used to communicate among goroutines. Values of any type (including other channels!) can be -sent over a channel. Channels can be unbuffered or buffered (using a buffer length specified at channel-construction time). - -Channels are first-class values; they can be stored in variables and passed to and from functions like any other value. (When supplied to -functions, channels are passed by reference.) Channels are also typed: a `chan int` is different from a `chan string`. - -Because they are so widely used in Go programs, channels are (intended to be) efficient and cheap. To send a value on a channel, use `<-` as a binary operator. To receive a value on a channel, use `<-` as a unary operator. Channels can be shared among multiple senders and multiple receivers and guarantee that each value sent is received by at most one receiver. - -Here is an example of using a manager function to control access to a single value. - -```go -type Cmd struct { - Get bool - Val int -} - -func Manager(ch chan Cmd) { - val := 0 - for { - c := <-ch - if c.Get { - c.Val = val - ch <- c - } else { - val = c.Val - } - } -} -``` - -In that example the same channel is used for input and output. This is incorrect if there are multiple goroutines communicating with the manager at once: a goroutine waiting for a response from the manager might receive a request from another goroutine instead. A solution is to pass in a channel. - -```go -type Cmd2 struct { - Get bool - Val int - Ch chan<- int -} - -func Manager2(ch <-chan Cmd2) { - val := 0 - for { - c := <-ch - if c.Get { - c.Ch <- val - } else { - val = c.Val - } - } -} -``` - -To use `Manager2`, given a channel to it: - -```go -func getFromManagedChannel(ch chan<- Cmd2) int { - myCh := make(chan int) - c := Cmd2{true, 0, myCh} // Composite literal syntax. - ch <- c - return <-myCh -} - -func main() { - ch := make(chan Cmd2) - go Manager2(ch) - // ... some code ... - currentValue := getFromManagedChannel(ch) - // ... some more code... -} -``` \ No newline at end of file diff --git a/GoGenerateTools.md b/GoGenerateTools.md index a9bb66c6..ee8a9e93 100644 --- a/GoGenerateTools.md +++ b/GoGenerateTools.md @@ -1,36 +1,4 @@ -[`go generate`](https://go.dev/blog/generate) is only useful if you have tools to use it with! Here is an incomplete list of useful tools that generate code. - -* [goyacc](https://pkg.go.dev/golang.org/x/tools/cmd/goyacc) – Yacc for Go. -* [stringer](https://pkg.go.dev/golang.org/x/tools/cmd/stringer) – Implements `fmt.Stringer` interface for enums. -* [gostringer](https://pkg.go.dev/github.com/sourcegraph/gostringer) – Implements `fmt.GoStringer` interface for enums. -* [jsonenums](https://github.com/campoy/jsonenums) – Implements `json.Marshaler` and `json.Unmarshaler` interfaces for enums. -* [go-syncmap](https://pkg.go.dev/github.com/searKing/golang/tools/cmd/go-syncmap) - Generates Go code using a package as a generic template for `sync.Map`. -* [go-syncpool](https://pkg.go.dev/github.com/searKing/golang/tools/cmd/go-syncpool) - Generates Go code using a package as a generic template for `sync.Pool`. -* [go-atomicvalue](https://pkg.go.dev/github.com/searKing/golang/tools/cmd/go-atomicvalue) - Generates Go code using a package as a generic template for `atomic.Value`. -* [go-nulljson](https://pkg.go.dev/github.com/searKing/golang/tools/cmd/go-nulljson) - Generates Go code using a package as a generic template that implements `database/sql.Scanner` and `database/sql/driver.Valuer`. -* [go-enum](https://pkg.go.dev/github.com/searKing/golang/tools/cmd/go-enum) - Generates Go code using a package as a generic template which implements interface `fmt.Stringer` | `binary` | `json` | `text` | `sql` | `yaml` for enums. -* [enumer](https://pkg.go.dev/github.com/alvaroloes/enumer) - Generates Go code that convert Go enum to/from strings. -* [go-import](https://pkg.go.dev/github.com/searKing/golang/tools/cmd/go-import) — Performs auto import of non go files. -* [gojson](https://github.com/ChimeraCoder/gojson) - Generates go struct definitions from example json documents. -* [vfsgen](https://github.com/shurcooL/vfsgen) - Generates a vfsdata.go file that statically implements the given virtual filesystem. -* [goreuse](https://github.com/dc0d/goreuse) - Generates Go code using a package as a generic template by replacing definitions. -* [embedfiles](https://4d63.com/embedfiles) - Embeds files into Go code. -* [ragel](https://www.colm.net/open-source/ragel/) - State machine compiler -* [peachpy](https://github.com/Maratyszcza/PeachPy) - x86-64 assembler embedded in Python, generates Go assembly -* [bundle](https://pkg.go.dev/golang.org/x/tools/cmd/bundle) - Bundle creates a single-source-file version of a source package suitable for inclusion in a particular target package. -* [msgp](https://github.com/tinylib/msgp) - A Go code generator for MessagePack -* [protobuf](https://github.com/golang/protobuf) - protobuf -* [thriftrw](https://github.com/thriftrw/thriftrw-go) - thrift -* [gogen-avro](https://github.com/actgardner/gogen-avro) - avro -* [swagger-gen-types](https://github.com/dnephin/swagger-gen-types) - go types from swagger specifications -* [avo](https://github.com/mmcloughlin/avo) - generate assembly code with Go -* [Wire](https://github.com/google/wire) - Compile-time Dependency Injection for Go -* [sumgen](https://github.com/smasher164/sumgen) - generate interface method implementations from sum-type declarations -* [interface-extractor](https://github.com/urandom/interface-extractor) - generates an interface of a desired type, with only methods used within the package. -* [deep-copy](https://github.com/globusdigital/deep-copy) - creates a deep copy method for the given types. -* [libfsm](https://github.com/katef/libfsm) - fsm toolkit supporting (among others) Go and Go-flavored amd64 assembly for matching regexps -* [re2c](https://re2c.org/index.html) - lexer generator for C, C++ and Go -* [re2dfa](https://gitlab.com/opennota/re2dfa) - Transform regular expressions into finite state machines and output Go source code -* [pigeon](https://github.com/mna/pigeon) - a PEG parser generator for Go +The Go wiki on GitHub has moved to go.dev (#61940). +Try or . diff --git a/GoGetProxyConfig.md b/GoGetProxyConfig.md index 417f4f13..1e0efd31 100644 --- a/GoGetProxyConfig.md +++ b/GoGetProxyConfig.md @@ -1,26 +1,4 @@ -Setting proxies for source code used by ` go get ` (listed in GoGetTools) +The Go wiki on GitHub has moved to go.dev (#61940). -## Windows command line -``` -$ set http_proxy=http://proxy.example.com:port -``` +Try or . -## git -``` -$ git config [--global] http.proxy http://proxy.example.com:port -``` - -## mercurial -Edit ` ~/.hgrc ` and add the following: -``` -[http_proxy] -host=proxy.example.com:port -``` - -## svn -Edit ` ~/.subversion/servers ` and add the following: -``` -[Global] -http-proxy-host=proxy.example.com -http-proxy-port=xxxx -``` \ No newline at end of file diff --git a/GoGetTools.md b/GoGetTools.md index 73e10b0c..1d4b1c88 100644 --- a/GoGetTools.md +++ b/GoGetTools.md @@ -1,12 +1,4 @@ -# Installing Version Control Tools for ` go get ` +The Go wiki on GitHub has moved to go.dev (#61940). -The ` go get ` fetching of source code is done by using one of the following tools expected to be found on your system: +Try or . - * **svn** - Subversion, download at: http://subversion.apache.org/packages.html - * **hg** - Mercurial, download at https://www.mercurial-scm.org/downloads - * **git** - Git, download at http://git-scm.com/downloads - * **bzr** - Bazaar, download at http://wiki.bazaar.canonical.com/Download - -For example, **git** is used for Github, **hg** is used for Bitbucket, etc. - -Refer [GoGetProxyConfig](GoGetProxyConfig) for setting proxies for these tools. \ No newline at end of file diff --git a/GoMips.md b/GoMips.md index 7e28b254..4b3df99c 100644 --- a/GoMips.md +++ b/GoMips.md @@ -1,96 +1,4 @@ -# Introduction +The Go wiki on GitHub has moved to go.dev (#61940). -Go programs can be cross-compiled e.g., on x86/x86\_64 build systems to run on MIPS target machines. +Try or . -# Supported architectures - -Go supports the following MIPS architectural families. (Are there more?) - -| **Architecture** | **Status** | **GOMIPS value** | **GOARCH value** | -|:-----------------|:-----------|:----------------|:-----------------| -| Big endian (e.g., ar71xx) | supported | GOMIPS=softfloat| GOARCH=mips | -| Little endian | supported | n/a | GOARCH=mipsle | - -# Supported operating systems - -* MIPS on Linux. Tested with an ar71xx based OpenWrt device. - -# Recommended Go version - -The tested version for running Go on MIPS systems is Go 1.13. - -# Tips and tricks - -## Building for ar71xx OpenWrt - -This builds a Go program, strips unneeded strings and symbols to minimize its size, and compresses it to further minimize its size: - -``` -env GOOS=linux GOARCH=mips GOMIPS=softfloat go build -trimpath -ldflags="-s -w" 'server.go' -upx -9 server -``` - -# Success stories - -MIPS hardware comes in a myriad of shapes and sizes. If you've had a success story building and running Go on your Arm system, please detail your results here. - -## D-Link DIR-505 Mobile Companion - -Architecture: ar71xx - -Operating System: OpenWrt - -The D-Link DIR-505 Mobile Companion comes with an Atheros AR1311 processor, 8 MB flash and 64 MB RAM. This space is limited but allows us to load Go applications, e.g., from network into `/tmpfs` and execute them from there. - -Further information about the device can be found at https://openwrt.org/toh/d-link/dir-505. - -## Teltonika - -### RUT955 - -Architecture: ar9344 - -Operating System: RutOS (based on OpenWrt) - -The Teltonika RUT955 has a Atheros Wasp MIPS 74Kc CPU running at 550 MHz with 16 MB flash 128 MB RAM. Inbuilt flash will be insufficient for most applications but a Micro SD or USB stick can be added (running application directly from SD was unreliable but copying to /tmpfs and running from there works OK). The inbuilt IO, GPS etc can be accessed via Modbus TCP and the RS232/RS485 ports worked without issue. Tested with Go 1.14.6, 1.15.3 & 1.21.1 (GOARCH=mips, GOMIPS=softfloat). - -Further information about the device can be found at https://teltonika-networks.com/product/rut955/. - -### RUT956 - -Architecture: MediaTek MT7628AN ver:1 eco:2 - -Operating System: RutOS (based on OpenWrt) - -The Teltonika RUT956 has a Mediatek MIPS 24KEc CPU running at 580 MHz with 16 MB flash 128 MB RAM. Inbuilt flash will be insufficient for most applications but a USB stick can be added. The inbuilt IO, GPS etc can be accessed via Modbus TCP and the RS232/RS485 ports worked without issue. Tested with Go 1.21.1 (GOARCH=mipsle, GOMIPS=softfloat). Note that `illegal instruction` is output if `GOMIPS` is not set. - -Further information about the device can be found at https://teltonika-networks.com/product/rut956/. - -## TP-Link Archer A6 WiFi Router - -Architecture: ath79 (same hardware as ar71xx, but with native kernel support) - -Operating System: OpenWrt - -The TP-Link Archer A6 comes with an Atheros QCA9563 MIPS 24K classic processor, 16 MB flash, and 128 MB RAM. Flash storage is limited and no USB ports are available for storage expansion, so programs are loaded from the network into /tmpfs and executed. - -Further information about the device can be found at https://openwrt.org/toh/hwdata/tp-link/tp-link_archer_a6_us_tw. - -## Belkin F7D7302 WiFi Router - -Architecture: mipsel_74kc - -Operating System: DD-WRT - -The Belkin F7D7302 comes with a Broadcom BCM4716 little-endian MIPS 74K classic processor, 8 MB flash, and 64 MB RAM. Flash storage is severely limited, but there is a USB port available so programs can be loaded onto a flash drive and executed. - -Further information about the device can be found at https://openwrt.org/toh/belkin/f7d3302. - -## AVM FRITZ!Box 7362 SL - -System type: xRX200 rev 1.2 \ -CPU model: MIPS 34Kc V5.6 - -Operating System: OpenWrt 21 - -Further information about the device can be found at https://openwrt.org/toh/avm/avm_7362_sl. \ No newline at end of file diff --git a/GoStrings.md b/GoStrings.md index 8974ed9a..cf8ae45e 100644 --- a/GoStrings.md +++ b/GoStrings.md @@ -1,59 +1,4 @@ -Strings are **not** required to be UTF-8. Go source code **is** required -to be UTF-8. There is a complex path between the two. +The Go wiki on GitHub has moved to go.dev (#61940). -In short, there are three kinds of strings. They are: +Try or . - 1. the substring of the source that lexes into a string literal. - 1. a string literal. - 1. a value of type string. - -Only the first is required to be UTF-8. The second is required to be -written in UTF-8, but its contents are interpreted various ways -and may encode arbitrary bytes. The third can contain any bytes at -all. - -Try this on: - -``` -var s string = "\xFF語" -``` -Source substring: ` "\xFF語" `, UTF-8 encoded. The data: - -``` -22 -5c -78 -46 -46 -e8 -aa -9e -22 -``` - -String literal: ` \xFF語 ` (between the quotes). The data: - -``` -5c -78 -46 -46 -e8 -aa -9e -``` - -The string value (unprintable; this is a UTF-8 stream). The data: - -``` -ff -e8 -aa -9e -``` - -And for record, the characters (code points): -``` - -語 U+8a9e -``` \ No newline at end of file diff --git a/GoTalks.md b/GoTalks.md index 66110285..87ad98ad 100644 --- a/GoTalks.md +++ b/GoTalks.md @@ -1,391 +1,4 @@ -# Go talks +The Go wiki on GitHub has moved to go.dev (#61940). -Check out http://talks.golang.org for presentations for some of the talks. For a comprehensive, curated and searchable index, try [GopherVids](http://gophervids.appspot.com/) from Damian Gryski. +Try or . -# Official - -## Introductory Talks - -An introduction to Go. - -### Russ Cox's Tour of Go - -[[video and discussion](http://research.swtch.com/gotour)] - -Three things that make Go fast, fun, and productive:interfaces, reflection, and concurrency. Builds a toy web crawler to demonstrate these. - -### Go: a simple programming environment - -[[video](http://vimeo.com/53221558)] -[[another video](http://vimeo.com/69237265)] -[[slides](http://talks.golang.org/2012/simple.slide)] - -Go is a general-purpose language that bridges the gap between efficient statically typed languages and productive dynamic language. But it’s not just the language that makes Go special – Go has broad and consistent standard libraries and powerful but simple tools. - -This talk gives an introduction to Go, followed by a tour of some real programs that demonstrate the power, scope, and simplicity of the Go programming environment. - -### Get Started with Go - -[[video](http://www.youtube.com/watch?v=2KmHtgtEZ1s)] - -Get a feel for the language and its standard libraries and tools in this session, where we go through installing Go and writing some simple but useful -programs. - -### Go Programming - -[[video](http://www.youtube.com/watch?v=jgVhBThJdXc)] -[[code](http://talks.golang.org/2010/io/)] - -A presentation delivered by Rob Pike and Russ Cox at Google I/O 2010. It -illustrates how programming in Go differs from other languages through a set of -examples demonstrating features particular to Go. These include concurrency, -embedded types, methods on any type, and program construction using interfaces. - -### The Go Tech Talk - -[[video](http://www.youtube.com/watch?v=rKnDgT73v8s)] -[[slides](http://talks.golang.org/2009/go_talk-20091030.pdf)] - -An hour-long talk delivered by Rob Pike at Google in October 2009. -The language's first public introduction. The language has changed since it was made, -but it's still a good introduction. - -## Development in Go - -### Writing Web Apps in Go - -[[video](http://www.youtube.com/watch?v=-i0hat7pdpk)] -[[slides](http://talks.golang.org/2011/Writing_Web_Apps_in_Go.pdf)] - -A talk by Rob Pike and Andrew Gerrand presented at Google I/O 2011. -It walks through the construction and deployment of a simple web application -and unveils the [Go runtime for App Engine](https://go.dev/blog/2011/05/go-and-google-app-engine.html). - -### Real World Go - -[[video](http://www.youtube.com/watch?v=7QDVRowyUQA)] -[[slides](http://talks.golang.org/2011/Real_World_Go.pdf)] - -A talk by Andrew Gerrand presented at Google I/O Bootcamp 2011. -It gives a broad overview of Go's type system and concurrency model -and provides four examples of Go programs that solve real problems. - -### Building Integrated Apps on Google's Cloud Platform - -[[video](http://www.youtube.com/watch?v=Mo1YKpIF1PQ)] - -A talk by Andrew Gerrand presented at Google Developer Day Japan 2011. -It discusses the development of a web application that runs on Google -App Engine and renders raytraced that it stores on Google Cloud Storage. - -### High Performance Apps with Go on App Engine - -Google I/O, May 2013 - -[[video](http://www.youtube.com/watch?v=fc25ihfXhbg)] -[[slides](http://talks.golang.org/2013/highperf.slide)] - -### Practical Go Programming - -[[video](http://www.youtube.com/watch?v=2-pPAvqyluI)] -[[slides](http://wh3rd.net/practical-go)] -[[code](http://github.com/nf/goto)] - -This talk presents the development of a complete web application in Go. -It looks at design, storage, concurrency, and scaling issues in detail, using -the simple example of an URL shortening service. - -### Lexical Scanning in Go - -[[video](http://www.youtube.com/watch?v=HxaD_trXwRE)] - -This GTUG talk by Rob Pike discusses the detailed design of a lexical scanner that uses Go's -features in expressive combinations. (The discussion near the end about avoiding goroutines -at initialization is obsolete: Go 1 allows goroutines in init functions so the extra complexity -is unnecessary.) - -### Go in Production - -Google I/O, June 2012 - -[[video](http://www.youtube.com/watch?v=kKQLhGZVN4A)] - -Since Go's release in 2009 many companies (besides Google, of course) have used the language to build cool stuff. In this session programmers from several companies will share their first-hand experience using Go in production environments. - -### Go: code that grows with grace - -[[video](http://vimeo.com/53221560)] -[[slides](http://talks.golang.org/2012/chat.slide)] - -One of the Go Programming Language’s key design goals is code adaptability; that it should be easy to take a simple design and build upon it in a clean and natural way. In this talk I describe a simple “chat roulette” server that matches pairs of incoming TCP connections, and then use Go’s concurrency mechanisms, interfaces, and standard library to extend it with a web interface and other features. Although the function of the program changes dramatically, the inherent flexibility of Go allows the original design to remain intact as it grows. - -### Implementing a bignum calculator - -[[video](https://www.youtube.com/watch?v=PXoG0WX0r_E)] -[[slides](http://go-talks.appspot.com/github.com/robpike/ivy/talks/ivy.slide)] - -Rob Pike describes his interpreter for an APL-like calculator language. - -### Go in Go - -[[video](https://www.youtube.com/watch?v=cF1zJYkBW4A)] -[[slides](https://talks.golang.org/2015/gogo.slide)] - -Rob Pike speaks on moving the Go toolchain from C to Go - -## Concurrency in Go - -### Go concurrency patterns - -Google I/O, June 2012 - -[[video](http://www.youtube.com/watch?v=f6kdp27TYZs)] - -### Advanced Concurrency Patterns - -[[video](https://www.youtube.com/watch?v=QDDwwePbDtw)] -[[slides](http://talks.golang.org/2013/advconc.slide)] - -Google I/0, May 2013 - -Concurrency is the key to designing high performance network services. This talk expands on last year's popular Go Concurrency Patterns talk to dive deeper into Go's concurrency primitives, and see how tricky concurrency problems can be solved gracefully with simple Go code. - -## Design of Go - -### The Expressiveness Of Go - -[[slides](http://talks.golang.org/2010/ExpressivenessOfGo-2010.pdf)] - -A discussion of the qualities that make Go an expressive and comprehensible -language. The talk was presented by Rob Pike at JAOO 2010. -The recording of the event was lost due to a hardware error. - -### Another Go at Language Design - -[[video](http://sydney.edu.au/engineering/it/videos/seminar_pike) from Sydney University] -[[slides](http://assets.en.oreilly.com/1/event/45/Another%20Go%20at%20Language%20Design%20Presentation.pdf)] - -A tour, with some background, of the major features of Go, intended for -an audience new to the language. The talk was presented at OSCON 2010. -This talk was also delivered at Sydney University in September 2010. - -### Go Emerging Languages Conference Talk - -[[video](http://confreaks.com/videos/115-elcamp2010-go)] -[[slides](http://assets.en.oreilly.com/1/event/45/Go%20Presentation.pdf)] - -Rob Pike's Emerging Languages Conference presentation delivered in July 2010. Talk abstract: - -> Go’s approach to concurrency differs from that of many languages, even those -> (such as Erlang) that make concurrency central, yet it has deep roots. The path -> from Hoare’s 1978 paper to Go provides insight into how and why Go works as it -> does. - -## The State of Go - -### June 2014 - -[[video](https://www.youtube.com/watch?v=0KF44QtoByk)] -[[slides](https://talks.golang.org/2014/state-of-go.slide)] - -### February 2015 - -[[video](https://www.youtube.com/watch?v=Kd8EqTvW5EQ)] -[[slides](https://talks.golang.org/2015/state-of-go.slide)] - -### May 2015 - -[[video](https://www.youtube.com/watch?v=S9Bu6fZnLGM)] -[[slides](https://talks.golang.org/2015/state-of-go-may.slide)] - - -## Miscellaneous - -### The Go frontend for GCC - -[[paper](http://talks.golang.org/2010/gofrontend-gcc-summit-2010.pdf)] - -A description of the Go language frontend for gcc. -Ian Lance Taylor's paper delivered at the GCC Summit 2010. - -### The Go Promo Video - -[[video](http://www.youtube.com/watch?v=wwoWei-GAPo)] - -A short promotional video featuring Russ Cox demonstrating Go's fast compiler. - -### Meet the Go team - -Google I/O, June 2012 - -[[video](http://www.youtube.com/watch?v=sln-gJaURzk)] - -A panel discussion with David Symonds, Robert Griesemer, Rob Pike, Ken Thompson, Andrew Gerrand, and Brad Fitzpatrick. - -### Fireside Chat with Go team - -Google I/0, May 2013 - -[[video](http://www.youtube.com/watch?v=p9VUCp98ay4)] - -A fireside chat with Andrew Gerrand, Brad Fitzpatrick, David Symonds, Ian Lance Taylor, Nigel Tao, Rob Pike, Robert Griesemer, Sameer Ajmani. - -### The State of the Gopher - -[[video](https://www.youtube.com/watch?v=4KFTacxqkcQ)] -[[slides](https://talks.golang.org/2014/state-of-the-gopher.slide)] - -# Unofficial - -Talks by members of the community. - -### Let's Go, or introduction to Go - -[[video (starting at 14:35)](http://live.digicast.ru/view/1582)] -[[slides](http://talks.godoc.org/github.com/AlekSi/LetsGo/lets-go.slide)] -[[source](https://github.com/AlekSi/LetsGo)] - -This talk gives an introduction to Go in Russian. - -### What are Go modules and how do I use them? -_[Paul Jolly](https://twitter.com/_myitcv) at [**LondonGophers**](https://twitter.com/LondonGophers)_ - -[[video](https://youtu.be/6MbIzJmLz6Q)] -[[slides](https://talks.godoc.org/github.com/myitcv/talks/2018-08-15-glug-modules/main.slide#1)] - -### What else is in Go 1.11 -_[Daniel Martì](https://twitter.com/mvdan_) at [**LondonGophers**](https://twitter.com/LondonGophers)_ - -[[video](https://youtu.be/mQYjjVCGVJ8)] -[[slides](https://talks.godoc.org/github.com/mvdan/talks/2018/go1.11.slide#1)] - -Sneak peak at the Go 1.11 release - -### Get Going with WebAssembly -_[Johan Brandhorst](https://twitter.com/JohanBrandhorst) at [**LondonGophers**](https://twitter.com/LondonGophers)_ - -[[video](https://youtu.be/iTrx0BbUXI4)] -[[slides](https://talks.godoc.org/github.com/johanbrandhorst/presentations/wasm-lightning/wasm.slide#1)] -[[code wasm](https://github.com/johanbrandhorst/wasm-experiments)] -[[code grpc](https://github.com/johanbrandhorst/grpcweb-wasm-example)] - -In this talk, Johan introduces you to the WebAssembly port in Go 1.11 and how it can help when dealing with JavaScript madness :) - -### Go and Mongo - and how it's changing -_[DJ Walker-Morgan](https://twitter.com/codepope) at [**LondonGophers**](https://twitter.com/LondonGophers)_ - -[[video](https://youtu.be/W22tZ5p3aDk)] -[[slides](https://github.com/codepope/talks/blob/master/GoAndMongo.pdf)] - -### Building a simple concurrency teaching language with Go -_[Nicholas Ng](https://twitter.com/nicholascwng) at [**LondonGophers**](https://twitter.com/LondonGophers)_ - -[[video](https://youtu.be/7cEp98y6WCs)] -[[slides](https://talks.godoc.org/github.com/nickng/londongophers-aug18/londongophers-aug18.slide#1)] - -In this talk Nicholas presents the design and implementation of a simple language designed for teaching concurrency theory (process calculi), implemented in Go. He covers some of Go's static analysis tools used in the implementation and show how you can use them too! - -### Introducing Remoto -_[Mat Ryer](https://twitter.com/matryer) at [**LondonGophers**](https://twitter.com/LondonGophers)_ - -[[video](https://youtu.be/dhbq7R7h-C0)] - -Mat shares the first glimpse of a new project that aims to make building RPC services easy. gRPC isn’t good for clients (especially web), and RESTful designs sometimes lead to confusing APIs. Remoto lets you define your service with a Go interface, and generate everything you need to build and consume the service. - -### Go Swagger -_[Simone Trubian](https://twitter.com/simone_trubian) at [**LondonGophers**](https://twitter.com/LondonGophers)_ - -[[video](https://youtu.be/PUejMR82RgU)] - -Simone gives an overview of the Go Swagger command line tool and briefly explain how he used it to improve productivity in designing REST API's. - -### ORMs in Go -_Renato Serra at [**LondonGophers**](https://twitter.com/LondonGophers)_ - -[[video](https://youtu.be/0XW6wI2FnPA)] - -Renato explains where ORMs can help, what the options were and what it's been like to use one. - -### Unused parameters in Go code -_[Daniel Martì](https://twitter.com/mvdan_) at [**LondonGophers**](https://twitter.com/LondonGophers)_ - -[[video](https://youtu.be/VW5jI6V_Y2c)] -[[slides](https://talks.godoc.org/github.com/mvdan/talks/2018/unparam.slide#1)] - -Daniel talks about how to use SSA and callgraphs to write powerful code analysis tools. In particular, he demonstrates how to detect unused parameters in functions. - -### Lies, Damn Lies, and Benchmarks -_Amnon at [**LondonGophers**](https://twitter.com/LondonGophers)_ - -[[video](https://youtu.be/YDPKUJndhw4)] -[[slides](https://talks.godoc.org/github.com/amnonbc/talks/lies.slide#1)] - -Amnon discusses why microbenchmarks can be misleading for optimising real world systems, why data layout is often more significant than code structure, and how Go can help us in the quest for performance. - -### A debugger from scratch -_[Liz Rice](https://twitter.com/LizRice) at [**LondonGophers**](https://twitter.com/LondonGophers)_ - -[[video](https://youtu.be/tZ5PUKbGjO4)] -[[slides](https://speakerdeck.com/lizrice/debuggers-from-scratch)] -[[code](https://github.com/lizrice/debugger-from-scratch)] - -Liz explains how a debugger works by building one in a few lines of Go. This includes mapping between Go source code and the machine code instructions it compiles to, and using the ptrace system call to set break points and examine and modify the running process. - -### Fast Fractal Fun With SDL -_[Sue Spence](https://twitter.com/virtualsue) at [**LondonGophers**](https://twitter.com/LondonGophers)_ - -[[video](https://youtu.be/eTjL3grAYAM)] -[[slides](https://gitlab.com/virtualsue/sdl-fractal/blob/master/Fast%20Fractal%20Fun.pdf)] -[[code](https://gitlab.com/virtualsue/sdl-fractal)] - -Go programs which create images such as the Mandelbrot & Julia sets often output an image file. I will show how to use Go bindings for the Simple Directmedia Layer library to output them on a display device instead. - -### Concurrency: a Journey from Ruby to Go -_[Mathilda Thompson](https://twitter.com/mathildathompso) at [**LondonGophers**](https://twitter.com/LondonGophers)_ - -[[video](https://youtu.be/mK3r5PDED-0)] - -### Go in a Polyglot Environment -_[Kevin McKelvin](https://twitter.com/kmckelvin) at [**LondonGophers**](https://twitter.com/LondonGophers)_ - -[[video](https://youtu.be/kWAxBhsEayk)] - -In this talk Kevin goes through his experience of adopting Go, moving to a polyglot environment, successes and challenges, and how Go fits into his company's overall architecture and strategy. - -### Delivering Go Services -_[Zak Knill](https://twitter.com/zakknill) at [**LondonGophers**](https://twitter.com/LondonGophers)_ - -[[video](https://youtu.be/pRdfJTuGxEw)] - -Delivering Go Services: After introducing Go to your company, and deploying your first go service. What are the next steps? This talk focuses on some of the things that come next, touching on the fabled "New service to prod in X (10, 20, 30) mins", as well as some gotchas along the way. - -### Go-ing Lambda - -_[David Blooman](https://twitter.com/dblooman) at [**LondonGophers**](https://twitter.com/LondonGophers)_ - -[[video](https://youtu.be/BBiIr19JOo4)] - -Go-ing Lambda - A year in production: How we(FundApps) used Go in lambda functions to build a service for importing/scraping/parsing data for financial services to build API's on top of. Tips and tricks of lambda functions in Go, limitations, performance and using the Apex framework. - -### The RED method - -_[Tom Wilkie](https://twitter.com/tom_wilkie) at [**LondonGophers**](https://twitter.com/LondonGophers)_ - -[[video](https://youtu.be/rc3V-k-JYAo)] - -We'll also have a section dedicated to those of you who are hiring or looking to get hired (if we'll miss it like last time, please don't be afraid to remind us). - -### Abusing Go’s net package for fun and profit -_[Michał Witkowski](https://twitter.com/MWitkow) at [**LondonGophers**](https://twitter.com/LondonGophers)_ - -[[video](https://youtu.be/JDjHFmke0ZI)] - -This talks into the details of how Go’s composition-based philosophy, as applied to the net package, can be creatively leveraged to beautiful and useful hacks that significantly augment the functionality of the stack. We’ll explore the net.Conn, and how one can (ab)use them in creative ways. We’ll take a peek into net/http, and explore how the http.Handler and http.Roundtripper interfaces can be creatively appropriated to build useful middleware. We’ll then dig even deeper into the net/http internals and how they related tls.Conn and x/net/http2, to understand how they work, and armed with that knowledge we’ll demonstrate some of our most beautiful hacks. - -### 2018's stringer -_[Daniel Martì](https://twitter.com/mvdan_) at [**LondonGophers**](https://twitter.com/LondonGophers)_ - -[[video](https://youtu.be/IyVEW19IkXE)] -[[slides](https://talks.godoc.org/github.com/mvdan/talks/2018/stringer.slide)] - -2018's stringer - a demonstration of new features you likely haven't heard of. \ No newline at end of file diff --git a/GoUserGroups.md b/GoUserGroups.md index b06ec713..e346dc04 100644 --- a/GoUserGroups.md +++ b/GoUserGroups.md @@ -1,234 +1,4 @@ -# Africa - * [Golang Buea](https://meetup.com/Docker-Buea) - Buea, Cameroon - * [Go Egypt](https://web.facebook.com/groups/563213043835298/) - Cairo, Egypt. - * [Go Cape Town](http://www.meetup.com/gocapetown/) - Cape Town. - * [golang-dakar](https://plus.google.com/u/0/communities/116552609416802012105) Dakar (Sénégal) - * [Joburg Golang Group](http://www.meetup.com/Joburg-Golang-Group/) - Johannesburg - * [angolang](https://plus.google.com/u/0/b/112645881964422842789/communities/111727796450195570970) Luanda, Angola - * [Golang Nigeria](https://www.meetup.com/GolangNigeria/) - Lagos, Nigeria - * [Golang Abuja](https://www.meetup.com/golang-abuja/) - Abuja, Nigeria - * [Gophers Mauritius](https://www.gophers.mu/) - Mauritius - * [cyberstorm.mu](https://cyberstorm.mu/) - Mauritius - * [Tunisian Gophers](https://www.facebook.com/TunisiaGolangcommunity/) - Tunisia - * [Nairobi Gophers](https://www.meetup.com/nairobi-gophers/) - Nairobi, Kenya +The Go wiki on GitHub has moved to go.dev (#61940). +Try or . -# Asia -* [Golang ِArabic Community](https://www.facebook.com/groups/111860102810970/) -* [Golang Azerbaijan](https://www.facebook.com/groups/852343094928521/) - Baku, Azerbaijan 🇦🇿 -* [Golang Iraq](https://www.facebook.com/groups/go.iraq/) - Iraq -* [Indonesia](https://golang-id.org) - Indonesia - * [GoJakarta](https://gophers.id/GoJakarta) - Jakarta, Indonesia. - * [Golang Surabaya](https://github.com/golangSurabaya) - Surabaya, Indonesia. -- Persia - * [Telegram Iranian Group](https://t.me/GolangFarsi) - Iran - * [devheroes Iran](https://devheroes.club/c/go) - Iran -- India - * [Golang New Delhi](https://www.meetup.com/GolangNewDelhi) - New Delhi, India. - * [Golang Bangalore](https://www.meetup.com/Golang-Bangalore) - Bangalore, India. - * [Golang Chennai](http://www.meetup.com/Chennai-golang-Meetup/) - Chennai, India - * [Golang Pune](https://www.meetup.com/Golang-Pune/) - Pune, India. - * [Golang Ahmedabad](https://www.meetup.com/Golang-Ahmedabad) - Ahmedabad, India. - * [Golang Kolkata](https://www.facebook.com/groups/125791539385850) - Kolkata, India. -- Japan - * [Gophers Japan](https://gocon.jp/) - Japan. - * [golang.tokyo](https://golangtokyo.github.io/) - Tokyo, Japan. - * [Akiba.go](https://akihabarago.connpass.com/) - Tokyo, Japan. - * [Women Who Go Tokyo](https://web.womenwhogo.tokyo/) - Tokyo, Japan. - * [kyoto.go](https://kyotogo.connpass.com/) - Kyoto, Japan. - * [Umeda.go](https://umedago.connpass.com/) - Osaka, Japan. - * [Sendai.go](https://techplay.jp/community/sendaigo) - Miyagi, Japan. - * [Fukuoka.go](https://fukuokago.dev/) - Fukuoka, Japan. - * [Okayama.go](https://okayamago.connpass.com/) - Okayama, Japan. - * [nagoya.go](https://nagoyago.connpass.com/) - Aichi, Japan. - * [Shizuoka.go](https://shizuoka-go.connpass.com/) - Shizuoka, Japan. - * [Golang札幌](https://golang-sapporo.connpass.com/) - Hokkaido, Japan. - * [Gopher道場](https://gopherdojo.org/) - Japan. - * [Go Language Specification 輪読会](https://gospecreading.connpass.com/) - Japan. - * [ゴリラ.Go](https://gorilla-go.connpass.com/) - Japan. - -- Other - * [Golang China](http://groups.google.com/group/golang-china) - China. - * [Golang Korea](https://www.facebook.com/groups/golangko/about/) - Korea. - * [Golang Vietnam](https://www.facebook.com/golang.org.vn) - [github](https://github.com/golang-vietnam) - Vietnam - * [Golang Taiwan](http://golang.tw) - Taiwan. - * [Golang Israel](http://www.meetup.com/Go-Israel) - Israel. - * [Singapore Gophers](https://www.facebook.com/groups/golang.sg/) - [Meetup](http://www.meetup.com/golangsg/) - Singapore - * [Golang UAE](https://plus.google.com/communities/114845275110994424259) - UAE. - * [Golang Malaysia](https://www.facebook.com/groups/mygolang/) - [Homepage](https://golang.my) - Malaysia. - * [Go Developers Network Bangladesh](https://www.facebook.com/groups/godevnet/) - Bangladesh. - * [Golang Pakistan](https://www.facebook.com/gopherpk/) - [Facebook Group](https://www.facebook.com/groups/2547735885480597) - Pakistan -# Europe - * [Bärner Go Meetup](https://www.meetup.com/Berner-Go-Meetup/) - Berne, Switzerland - * [Budapest Go Meetup](https://www.meetup.com/go-budapest/) - Budapest, Hungary - * [Athens Gophers](https://www.meetup.com/Athens-Gophers/) - Athens, Greece. - * [Golang Türkiye](https://www.facebook.com/groups/GolangTurkiye) - Istanbul, Turkey. - * [Gophers Aachen](https://www.meetup.com/Gophers-Aachen/) - Aachen, Germany. - * [Amsterdam, NL](http://www.meetup.com/golang-amsterdam/) - * [Belarus](http://gophers.by/) - Belarus. - * [Belfast Gophers](https://www.meetup.com/Belfast-Gophers/) - Belfast, UK. - * [Barcelona](http://golangbcn.org) - Barcelona, Catalunya, Spain. - * [Brno Golang](http://www.meetup.com/Golang-Brno/) - Brno, the Czech Republic - * [Golang Prague](https://www.meetup.com/Prague-Golang-Meetup/) - Prague, Czech Republic. - * [Cambridge Gophers](http://www.meetup.com/Cambridge-Gophers/) - Cambridge, UK - * [Suffolk Gophers](https://suffolkgophers.github.io/) - Suffolk, UK - * [Stuttgart Gophers](https://www.meetup.com/Stuttgart-Gophers/) - Stuttgart, Germany. - * [GDG Berlin Golang](http://www.meetup.com/golang-users-berlin/) - Berlin, Germany. - * [Go-User-Group-Hamburg](http://www.meetup.com/Go-User-Group-Hamburg) - Hamburg, Germany. - * [Go-User-Group Rhein-Ruhr](https://www.meetup.com/Go-Usergroup-Rhein-Ruhr) - Rhine-Ruhr region, Germany. - * [Go Lithuania User Group](http://gophers.lt/) - Lithuania, Kaunas. - * [Go London User Group](http://www.meetup.com/Go-London-User-Group/) - London, UK. - * [ManGo The Manchester Go User Group](http://mango.computer/) - Manchester, UK. - * [Golang Dorset](https://www.meetup.com/Golang-Dorset/) - Bournemouth, UK. - * [Golang Bristol++](https://www.meetup.com/golang-bristol/) - Bristol, UK. - * [GoSheffield](https://www.meetup.com/GoSheffield/) - Sheffield, UK. - * [GoMAD](https://www.meetup.com/go-mad/) - Madrid, Spain - * [Go Valhalla](https://t.me/joinchat/AAAAAEJGQn7K_oRUBWaNng) - Valencia, Spain. 🇻🇳 - * [Go Wales User Group](http://golang.cymru/) - Wales, UK. - * [Golang Москва](http://www.meetup.com/Golang-Moscow/) - Moscow, Russia. - * [Golang Питер](http://www.meetup.com/Golang-Peter/) - Saint Petersburg, Russia. - * [Golang Новосибирск](http://www.meetup.com/GolangNSK/) - Novosibirsk, Russia. - * [Golang Казань](https://www.meetup.com/Golang-Kazan/) - Kazan, Russia. - * [Go Yola](https://golang-yola.timepad.ru/) - Yoshkar-Ola, Russia. - * [Chisinau Golang Meetup](http://www.meetup.com/Chisinau-Golang-Meetup/) - Chisinau, Moldova - * [Munich Gophers](http://www.meetup.com/Munich-Gophers-Go-User-Group/) - Munich, Germany - * [Golang Paris](http://www.meetup.com/Golang-Paris) - Paris, France. - * [Golang Rennes](http://www.meetup.com/Golang-Rennes/) - Rennes, France. - * [Golang Lyon](http://www.meetup.com/fr-FR/Golang-Lyon/) - Lyon, France. - * [Golang Lille](http://www.meetup.com/Golang-Lille) - Lille, France. - * [Golang Marseille](https://www.meetup.com/Golang-Marseille/) - Marseille, France. - * [golang-pl](https://groups.google.com/forum/?fromgroups#!forum/golang-pl) - Poland. - * [Gophers Katowice](http://www.meetup.com/Gophers-Katowice) - Katowice, Poland. - * [Golang Warsaw](http://www.meetup.com/Golang-Warsaw) - Warsaw, Poland. - * [G.L.U.G. Wroclaw](http://www.meetup.com/GoLang-User-Group-Wroclaw/) - Wroclaw, Poland - * [Golang User Group Trójmiasto](https://www.meetup.com/Golang-User-Group-Trojmiasto/) - Gdańsk/Gdynia/Sopot, Poland - * [Go-Stockholm](http://www.meetup.com/Go-Stockholm/) - Stockholm, Sweden. - * [Go-Uppsala](http://www.meetup.com/Go-Uppsala/) - Uppsala, Sweden. - * [Go-Malmö](http://www.meetup.com/Go-Malmo/) - Malmö, Sweden. - * [golang-greece](https://groups.google.com/forum/#!forum/golang-greece) - Greece - * [GolangIT](http://golangit.github.io/) - Italy. - * [Go-Turkey](https://plus.google.com/communities/101920753066440157216) - Turkey. - * [Go Graz](http://gograz.org) - Graz, Austria - * [Meetup Belgium](http://www.meetup.com/Golang-Belgium/) - Belgium - * [Meetup Lausanne](http://www.meetup.com/Lausanne-golang-Meetup) - Lausanne, Switzerland - * [Meetup Zurich](http://www.meetup.com/Zurich-Gophers/) - Zurich, Switzerland - * [Meetup Frankfurt](http://www.meetup.com/Frankfurt-Gophers-Meetup/) - Frankfurt am Main, Germany - * [Go-ningen](http://www.meetup.com/Go-ningen/) - Groningen, The Netherlands - * [Golang Ljubljana](http://www.meetup.com/Slovenian-Go-lang-User-Group/) - Ljubljana, Slovenia - * [Go Euregio](https://plus.google.com/communities/116272759718686417490) - Maastricht, Netherlands; Liège/Hasselt, Belgium; Aachen, Germany - * [Ukrainian Golang User Group](http://www.meetup.com/uagolang/) - Kyiv, Ukraine - * [L'viv Golang Group](http://www.meetup.com/Lviv-Golang-Group/) - L'viv, Ukraine - * [Go SXB, Go!](http://www.meetup.com/fr-FR/Go-SXB-Go/) - Strasbourg, France - * [Hannover Gophers Meetup](http://www.meetup.com/de-DE/Hannover-Gophers-Meetup/) - Hannover, Germany - * [Golang Nürnberg](http://www.meetup.com/de-DE/Golang-Nuernberg/) - Nürnberg, Germany - * [Helsinki Gophers](http://www.meetup.com/Helsinki-Gophers/) - Helsinki, Finland - * [Golang Cologne](http://www.meetup.com/Golang-Cologne/) - Cologne/Bonn, Germany - * [Golang Vilnius](http://www.meetup.com/Vilnius-Golang/) - Vilnius, Lithuania - * [Meetup Surrey](http://www.meetup.com/Surrey-Go-User-Group-Meetup/) - Surrey, UK - * [Golang Zagreb](https://www.meetup.com/Golang-ZG/) - Zagreb, Croatia - * [Meetup Edinburgh](https://www.meetup.com/Edinburgh-Golang-meetup/) - Edinburgh, UK - * [Münster Gophers](https://www.meetup.com/de-DE/Munster-Gophers/) - Münster, Germany - * [Vienna.go - Vienna Go User Group](https://www.meetup.com/Vienna-go-Vienna-Go-User-Group/events/242583645/) - Vienna, Austria - * [Golang Bulgaria](https://www.meetup.com/Golang-Bulgaria/) - Sofia, Bulgaria 🇧🇬 - * [Go Oslo User Group](https://www.meetup.com/Go-Oslo-User-Group/) - Oslo, Norway - * [Gophers Linz](https://www.meetup.com/Gophers-Linz/) - Linz, Austria - * [Golang Rotterdam](https://www.meetup.com/Golang-Rotterdam/) - Rotterdam, Netherlands - * [Leipzig Gophers](https://golangleipzig.space/) - Leipzig, Germany - * [Golang Estonia](https://www.meetup.com/Golang-Estonia/) - Estonia - -# North America - -## Canada - - * [Edmonton Go Meetup](https://edmontongo.org/) - Edmonton AB, Canada. - * [vangophers](http://groups.google.com/group/vangophers) - Vancouver BC, Canada. - * [Go Vancouver](https://plus.google.com/u/0/communities/106063002572645508555) - Vancouver BC, Canada. - * [GolangVan meetup](http://www.meetup.com/golangvan/) - Vancouver BC, Canada. - * [GolangVan](http://golangvan.org/) - Vancouver BC, Canada. - * [GoTO](http://www.meetup.com/go-toronto) - Toronto ON, Canada. - * [Ottawa Go](http://www.meetup.com/Ottawa-Go-Meetup/) - Ottawa ON, Canada. - * [KW Go Developers](http://www.meetup.com/Golang-KW/) - Waterloo, ON, Canada. - * [Golang Montréal](https://golangmontreal.org/) - Montréal, QC - * [Golang Winnipeg](https://www.meetup.com/Golang-Wpg-Meetup/) - Winnipeg MB, Canada - -## Dominican Republic - - * [Golang Dominicana](https://www.facebook.com/groups/golangdominicana) - República Dominicana. - -## Latin America - - * [Golang-ES](https://www.facebook.com/groups/goenespanol) - Facebook Español-Latino. - * [Gophers LATAM](https://discord.com/invite/AEarh2kSvn) - Discord Español-Latino. - -## Mexico - - * [Golang - Go MX](https://www.facebook.com/groups/es.golang.mx) - All Mexico - * [GophersMX](https://www.meetup.com/es/GophersMX/) - Ciudad de México, México - * [Golang Monterrey](http://www.meetup.com/Golang-MTY/) - Monterrey, Mexico - * [Golang Guadalajara](https://www.meetup.com/es/Golang-Guadalajara/) - Guadalajara, México - -## United States - - * [Los-Angeles-Gophers](http://www.meetup.com/Los-Angeles-Gophers/) - Los Angeles CA, USA. - * [Westside GoLang Meetup](https://www.meetup.com/Westside-GoLang-Meetup/) - Los Angeles CA, USA. - * [OC Gophers](http://www.meetup.com/Orange-County-Gophers) - Orange County CA, USA. - * [SDGophers](http://www.meetup.com/sdgophers/) — San Diego CA, USA - * [GoSF](http://www.meetup.com/golangsf/) - San Francisco CA, USA. - * [GoSV](http://www.meetup.com/GolangSV/) - San Mateo CA, USA. - * [Boulder Gophers](https://www.meetup.com/Boulder-Gophers/) - Boulder CO, USA. - * [Denver Go Language User Group](http://www.meetup.com/Denver-Go-Language-User-Group/) - Denver CO, USA. - * [DTC Go Meetup](https://www.meetup.com/Denver-Go-Programming-Language-Meetup/) - Denver Tech Center CO, USA. - * [Go-Miami](http://www.meetup.com/Go-Miami/) - Miami FL, USA. - * [Orlando Go Users](https://www.meetup.com/OrlanGo/) - Orlando FL, USA - * [Go-Users-Group-Atlanta](http://www.meetup.com/Go-Users-Group-Atlanta/) - Atlanta GA, USA. - * [chicagolang](http://groups.google.com/group/chicagolang) - Chicago IL, USA. - * [Chicago Ultimate Golang](https://www.meetup.com/Chicago-Ultimate-Golang/) - Chicago IL, USA. - * [Boston Golang](http://bostongolang.org) - Boston MA, USA. - * [Framingham Go](https://www.meetup.com/Framingham-Golang-Meetup/) - Framingham MA, USA. - * [GoMN](http://www.meetup.com/golangmn/) - Minneapolis MN, USA. - * [Buffalo GoLang Meetup Group](https://www.meetup.com/Buffalo-GoLang-Meetup-Group/) - Buffalo NY, USA. - * [New York Go Language Meetup](http://www.meetup.com/golangny/) - New York NY, USA. - * [New Jersey Go Language Meetup](http://www.meetup.com/golangnj/) - New Jersey NY, USA. - * [Bowery Golang Meetup](https://www.meetup.com/Bowery-Go/) - New York NY, USA. - * [GoLangPhilly](http://www.meetup.com/GoLangPhilly/) - Philadelphia PA, USA. - * [GoLangPhoenix](http://www.meetup.com/Golang-Phoenix/) - Phoenix AZ, USA. - * [GoLangCleveland](https://www.golangcleveland.org/) - Cleveland OH, USA. - * [Cincinnati Golang Meetup](https://www.meetup.com/Cincinnati-Golang-Meetup/) - Cincinnati, OH, USA. - * [EUG-Go](http://www.meetup.com/EUG-Go/) - Eugene, OR, USA. - * [PDX-Go](http://www.meetup.com/PDX-Go/) - Portland, OR, USA. - * [GoLancaster](http://www.meetup.com/GoLancaster/) - Lancaster PA, USA. - * [ATX-Golang](http://www.meetup.com/atxgolang/) - Austin TX, USA. - * [GoDFW](http://www.meetup.com/GoCowboys/) - Dallas TX, USA. - * [Golang Houston](http://www.meetup.com/Golang-Houston/) - Houston TX, USA. - * [Utah Golang (#UTGO)](http://utahgolang.com/) - Salt Lake City UT, USA. - * [Golang-DC](http://www.meetup.com/Golang-DC/) - Arlington VA, USA. - * [Seattle Go Programmers](http://www.meetup.com/golang/) - Seattle WA, USA. - * [Go Charlotte Meetup](http://www.meetup.com/golangclt/) - Charlotte NC, USA - * [Triangle Golang](http://www.meetup.com/Triangle-Golang-Meetup/) - Raleigh NC, USA. - * [Las Vegas Go Meetup](http://www.meetup.com/Las-Vegas-Go-Meetup/) - Las Vegas NV, USA. - * [Ann Arbor Gophers](http://www.meetup.com/Ann-Arbor-Gophers/) - Ann Arbor MI, USA - * [Baltimore Metro Area Golang](http://baltimoregolang.org) - Baltimore MD, USA - * [Nashville Gophers](https://nashgo.org) - Nashville TN, USA - * [Omaha Gophers](https://www.meetup.com/omaha-gophers/) - Omaha NE, USA - * [St Louis Go Meetup](https://www.meetup.com/StL-Go/) - St Louis, MO, USA - - -# Oceania - * [Canberra Gophers](https://plus.google.com/u/1/communities/114036877112593565975) - Canberra, Australia. - * [golang-sydney](http://www.meetup.com/golang-syd/) - Sydney, Australia. - * [golang-nz](http://groups.google.com/group/golang-nz) - New Zealand. - * [Golang Wellington](https://www.meetup.com/wellington-golang/) - Wellington, New Zealand. - * [Melbourne-Go-Nuts](http://www.meetup.com/Melbourne-Go-Nuts) - Melbourne, Australia. - * [Brisbane Gophers](http://www.meetup.com/Brisbane-Golang-Meetup/) - Brisbane, Australia. - * [Honolulu Go Users](http://hnlgo.org/) - Oahu, Hawaii - -# South America - * [Golang Brasil](https://www.meetup.com/pt-BR/golangbr/) - Brazil. - * [Golang Rio de Janeiro](https://www.meetup.com/pt-BR/Gophers-Rio) - Rio de Janeiro, Brazil. - * [Golang Recife](https://linktr.ee/golang_recife) - Recife, Pernambuco, Brazil. - * [Golang Argentina](http://www.meetup.com/es-ES/Golang-Argentina/) - Argentina. - * [Golang Medellín](http://www.meetup.com/Golang-Medellin/) - Colombia. - * [Golang Chile](https://groups.google.com/d/forum/golang-chile) - Chile. - * [Golang Panamá](https://groups.google.com/d/forum/golang-panama) - Panamá. - * [Golang Lima](http://www.meetup.com/es/Golang-Peru/) - Perú - * [Golang Venezuela](https://t.me/golangve) - Venezuela \ No newline at end of file diff --git a/GoUsers.md b/GoUsers.md index 2cc9d2cc..7c9007f7 100644 --- a/GoUsers.md +++ b/GoUsers.md @@ -1,1880 +1,4 @@ -# Companies currently using Go throughout the world +The Go wiki on GitHub has moved to go.dev (#61940). -## Countries - * [Africa](#africa) - * [Angola](#angola) - * [Argentina](#argentina) - * [Armenia](#armenia) - * [Australia](#australia) - * [Austria](#austria) - * [Bangladesh](#bangladesh) - * [Belarus](#belarus) - * [Belgium](#belgium) - * [Brazil](#brazil) - * [Bulgaria](#bulgaria) - * [Canada](#canada) - * [Chile](#chile) - * [China](#china) - * [Croatia](#croatia) - * [Colombia](#colombia) - * [Denmark](#denmark) - * [Estonia](#estonia) - * [Finland](#finland) - * [France](#france) - * [Germany](#germany) - * [Greece](#greece) - * [Hong Kong](#hong-kong) - * [Hungary](#hungary) - * [India](#india) - * [Indonesia](#indonesia) - * [Iraq](#iraq) - * [Iran](#iran) - * [Ireland](#ireland) - * [Israel](#israel) - * [Italy](#italy) - * [Japan](#japan) - * [Kazakhstan](#kazakhstan) - * [Korea (South)](#korea-south) - * [Lithuania](#lithuania) - * [Malaysia](#malaysia) - * [Mexico](#mexico) - * [Middle-East](#middle-east) - * [Moldova](#moldova) - * [Morocco](#morocco) - * [Nepal](#nepal) - * [Netherlands](#netherlands) - * [New Zealand](#new-zealand) - * [Nigeria](#nigeria) - * [Norway](#norway) - * [Oman](#oman) - * [Pakistan](#pakistan) - * [Philippines](#philippines) - * [Poland](#poland) - * [Portugal](#portugal) - * [Romania](#romania) - * [Russia](#russia) - * [Saudi Arabia](#saudi-arabia) - * [Serbia](#serbia) - * [Singapore](#singapore) - * [Slovenia](#slovenia) - * [South Africa](#south-africa) - * [Southeast Asia](#southeast-asia) - * [Spain](#spain) - * [Sri Lanka](#sri-lanka) - * [Sweden](#sweden) - * [Switzerland](#switzerland) - * [Taiwan](#taiwan) - * [Thailand](#thailand) - * [Turkey](#turkey) - * [Ukraine](#ukraine) - * [United Arab Emirates](#united-arab-emirates) - * [United Kingdom](#united-kingdom) - * [United States](#united-states) - * [Vietnam](#vietnam) +Try or . -## Africa - * [Afariat](https://afariat.com/) - Classifieds platform in Tunisia. - -## Angola - * [Nellcorp](https://nellcorp.com/) - Technology consulting agency. - -## Argentina - * [Mercadolibre](http://www.mercadolibre.com/) - Biggest E-Commerce platform in Latam. - * [Wilab](http://www.wilab.io/) - Industrial IoT platform. - * [Omnia](https://www.omniasalud.com/) - Administrative systems for health organizations - -## Armenia - * [PlayEngine](https://playengine.com/) - Automated and data-driven solution for sports betting. - -## Australia - * [Assembly Payments](https://assemblypayments.com/) - [github](https://github.com/AssemblyPayments) - Flexible payment solutions provider - * [Atlassian](http://atlassian.com/) - * [AusOcean](http://www.ausocean.org) - Helping our oceans through the use of technology. - * [BCZ](https://bcz.com/) - Free website creation platform. - * [Buildkite](https://buildkite.com/) - [github](https://github.com/buildkite/agent) - * [Crewmojo](https://crewmojo.com) - People management platform. - * [Dgraph Labs](http://dgraph.io) - [github](https://github.com/dgraph-io/dgraph) - * [Fleet Space Technologies](http://fleet.space/) - * [Fly365](http://fly365.com) - [github](https://github.com/fly365com) - * [mx51](https://mx51.io) - [github](https://github.com/mx51) - * [Massive Interactive](https://www.deltatre.com/massive) - * [MNF Group](https://mnfgroup.limited) - * [OneConfig](http://www.oneconfig.com) - [my.oneconfig.com](https://my.oneconfig.com/devices) - * [GO1](https://www.go1.com/) - * [SafetyCulture](https://safetyculture.com/) - * [Sajari](https://www.sajari.com) - [github](https://github.com/sajari) [blog](https://www.sajari.com/blog/upgrading-sajari-to-go-15) - * [SocietyOne](https://www.societyone.com.au/) - * [VERSENT](https://versent.com.au/) - * [Nine Publishing (formerly known as Fairfax Media)](https://www.nineentertainmentco.com.au/brands/nine-publishing) - -## Austria - * [Digital City Solutions](http://www.digital-city.io/) - * [Symflower](https://symflower.com/en), [github](https://github.com/symflower/) - -## Bangladesh - * [AppsCode Ltd.](https://appscode.com) (BD subsidiary of AppsCode Inc.) - [facebook](https://www.facebook.com/appscodebd/), [github](https://github.com/appscode), [twitter](https://twitter.com/appscodehq) - * [Furqan Software](https://furqansoftware.com) - * [Telenor Health](https://www.mytonic.com)(A health service company) built USSD server with go - * [Pathao](https://pathao.com)(A ride sharing company) - * [GAAN](http://gaan.com.bd) - * [Restra](https://github.com/restra-social) - * [ELO](https://elobyte.com) (Embedded Logic Operations) - -## Belarus - * [Cactussoft](https://cactussoft.biz/) - [github](https://github.com/cactussoft) - * [BykovSoft](https://bykovsoft.com) - [github](https://github.com/bykovme) - * [SmartPro](https://smartpro.by) - * [Spiral Scout](https://spiralscout.com) - [github](https://github.com/spiral) - * [Intelligent Speaker](https://intelligent-speaker.com) - proprietary fremium text-to-speech browser extension - * [Visutech Plating](https://visutechplating.by) - -## Belgium - * [Continu-IT NV](https://www.continu-it.be/) - * [IN4IT](https://www.in4it.io/) - * [Be-Mobile](http://www.be-mobile.com/) - * [Elimity](https://elimity.com/) - * [Factry](https://www.factry.io/) - [github](https://github.com/factrylabs) - * [nexuzhealth](https://www.nexuzhealth.be/nl/jobs) - * [OTA Insight](https://www.otainsight.com/) - * [Pronovix](http://pronovix.com/) - [github](https://github.com/Pronovix) - * [Showpad](https://www.showpad.com/) - * [UZ Leuven](https://www.uzleuven.be) - * [KU Leuven](https://www.kuleuven.be) - * [Twixl media](https://twixlmedia.com) - * [dploy.ai](https://dploy.ai) (MLOps platform | Belgium & remote :smiley:) - - -## Brazil - * [99 Taxis](http://www.99taxis.com/) - [github](https://github.com/99taxis) - * [Acesso](http://acesso.io/) - [github](https://github.com/acesso-io) - * [AStar](http://www.astarlabs.com) - [github](https://github.com/astarlabs) - * [Astrolink](http://www.astrolink.com.br) - [github](https://github.com/astrolink) - * [B2W](https://www.b2wmarketplace.com.br) - [github](https://github.com/b2wdigital) - * [Beauty Date](https://hairstyle-en.com/) - * [Bemobi](https://www.bemobi.com.br) - [linkedin](https://www.linkedin.com/in/michel-bernardo/) - * [Benefício Fácil](http://valetransporte.beneficiofacil.com.br/) - [forums](https://forum.golangbridge.org/t/weekly-wiki-wrapup-2015-11-07/1461/2) - * [Bexs](https://www.bexs.com.br/) - an forex Bank - * [BoaCompra](http://www.boacompra.com) - * [Catho](http://www.catho.com.br) - [github](https://github.com/catho) - * [CloudWalk](https://www.cloudwalk.io) - [github](https://github.com/cloudwalkio) - an open payment platform - * [Coderockr](http://coderockr.com) - * [Conductor](http://www.conductor.com.br) - * [Conta Azul](https://contaazul.com) - [github](https://github.com/ContaAzul) - * [Cora](https://www.cora.com.br) - [github](https://github.com/corabank) - * [DB1 Global Software](https://www.db1.com.br/) - [github](https://github.com/db1group) - * [Dafiti](https://www.dafiti.com.br/) - [github](https://github.com/dafiti) - * [Delivery Much](https://www.deliverymuch.com.br/) - [github](https://github.com/delivery-much) - * [Daki](https://www.soudaki.com/) - * [DAXPER](https://daxper.com.br) - [github](https://github.com/daxper) - * [Dinamize](https://www.dinamize.com.br/) - [github](https://github.com/dinamize) - * [Dito](http://dito.com.br/) - [github](https://github.com/ditointernet/) - * [Dropadev](http://dropadev.com) - * [Easy Carros](https://easycarros.com) - * [Emprego Ligado](https://empregoligado.com.br/#/) - * [Estratégia Concursos](https://www.estrategiaconcursos.com.br/) - [github](https://github.com/estrategiahq/) - * [Eventials](https://www.eventials.com/) - [github](https://github.com/eventials/) - * [Everymind](http://www.everymind.com.br/) - * [Finanças 360](https://www.financas360.com.br) - * [Fix Pay](https://fixpay.com.br)- [github](https://github.com/Fix-Pay) - * [Fliper](https://fliper.app) - * [Fluid](https://www.fluidapi.io) - * [FourTwo](https://www.fourtwo.com.br/) - [github](https://github.com/F0urTw0/) - * [Fundamentei](https://fundamentei.com.br) - * [GissOnline](http://www.gissonline.com.br) - * [Globo.com](http://www.globo.com) - [github](https://github.com/globocom) [article](http://www.wired.com/wiredenterprise/2013/03/tsuru) - * [Grupo Bandeirantes](https://www.band.uol.com.br/) - * [Grupo SBF](https://ri.gruposbf.com.br/) - [github](https://github.com/grupo-sbf) - * [Hash](https://www.hash.com.br) - [github](https://github.com/hashlab) - * [Hurb](http://www.hurb.com) - [github](https://github.com/HotelUrbano) - * [Hubcash](http://www.hubcash.com) - [github](https://github.com/hubcash/) - * [iFood](https://www.ifood.com.br/) - [github](https://github.com/orgs/ifood/) - * [In Loco](http://www.inlocomedia.com) - [github](https://github.com/In-Loco-Media) - * [Involves](https://www.involves.com) - [github](https://github.com/involvestecnologia) - * [IQ Escolhas Inteligentes](https://www.iq.com.br/) - [github](https://github.com/IQ-tech) - * [isaac](https://isaac.com.br/) - [github](https://github.com/olaisaac) - * [Jexia](http://jexia.com) - [github](https://github.com/jexia-inc) - * [Jusbrasil](https://www.jusbrasil.com.br) - [github](github.com/jusbrasil) - * [Koli](https://www.koli.com.br) - [github](https://github.com/koli) - * [Levpay](http://www.levpay.com/) - [github](https://github.com/levpay) - * [Loggi](https://www.loggi.com) - [github](https://github.com/loggi) - * [M4U](https://www.m4u.com.br) - [github](https://github.com/Mobile4You) - * [MadeiraMadeira](https://www.madeiramadeira.com.br/) - [github](https://github.com/madeiramadeirabr) - * [Magazine Luiza](http://www.magazineluiza.com.br) - [github](https://github.com/luizalabs) - * [Mendelics](http://www.mendelics.com) - [github](https://github.com/mendelics) - * [Mercado Livre](http://www.mercadolivre.com.br/) - [github](https://github.com/mercadolibre/) - * [Meu Astro](https://meuastro.com.br) - * [Moip Pagamentos](https://www.moip.com.br) - * [Mosaico](https://www.mosaico.com.br) - [github](https://github.com/somosmosaico) - Biggest content and sales generation platform in Brazil. Zoom, Buscapé and Bondfaro. - * [MundiPagg](https://www.mundipagg.com) - [github](https://github.com/mundipagg) - * [Neoway Business Solutions](http://www.neoway.com.br) - [github](https://github.com/NeowayLabs) - * [Newcore](https://www.newcore.com.br/) - * [Nic.br](http://www.nic.br) - [github](https://github.com/registrobr) - * [Nuveo](http://nuveo.com.br/) - [github](https://github.com/nuveo) - * [Olist](https://olist.com/) - [github](https://github.com/olist) - * [OLX Brasil](https://olx.com.br/) - [github](https://github.com/olxbr) - * [Open Vista Global](http://openvistaglobal.com.br) - * [OPLEN](http://www.oplen.com.br) - * [Pagar.me](https://pagar.me) - * [Pagro](https://www.pagro.com.br) - * [PagSeguro](https://pagseguro.uol.com.br) - * [PicPay](https://picpay.com) - * [Pismo](https://pismo.io) - * [Polícia Militar do Estado de Minas Gerais](https://www.policiamilitar.mg.gov.br) - * [PowerSystem-TI](https://www.pwrti.com) - * [Rednaxel](https://rednaxel.com/) - [github](https://github.com/rednaxelbr/rnx) - * [Resultados Digitais](http://www.resultadosdigitais.com.br/trabalhe-conosco) - * [Reviewr](https://reviewr.me/) - [github](https://github.com/reviewr) - * [Riocard Tecnologia da Informação](https://www.riocardmais.com.br/) - * [Sensedia](https://sensedia.com/) - * [Sage Brasil](http://www.sage.com/pt-br) - * [ServiceNet](http://www.servicenet.com.br) - * [SiBBr.gov.br](http://www.sibbr.gov.br) - [github](https://github.com/sibbr) - * [SumUp](https://sumup.com.br) - * [Stone Pagamentos](http://www.stone.com.br) - [github](https://github.com/stone-payments/) - * [Studio Sol](https://www.studiosol.com.br) - [github](https://github.com/StudioSol) - * [Synchro](http://www.synchro.com.br) - * [TOTVS](http://en.totvs.com/cloud) - * [TraiveFinance](https://traivefinance.com/) - * [TC Investimentos](https://tc.com.br/) - [github](https://github.com/tradersclub) - * [Ulife](http://www.ulife.com.br) - [github](https://github.com/ulifebr) - * [Unico](https://unico.io) - * [Universo Online](http://www.uol.com.br) - [github](https://github.com/uol) - * [VivaReal](http://www.vivareal.com.br) - [github](https://github.com/VivaReal) - * [Walmart](http://www.walmart.com.br) - * [Zup Innovation](https://github.com/ZupIT/ritchie-cli) - an open source tool that allows you to create, store and share automations - -## Bulgaria - * [clouWay](http://clouway.com/) - [github](https://github.com/clouway) - * [SumUp](https://sumup.com) - * [Gtmhub](https://gtmhub.com) - -## Canada - * [1Password](https://1password.com) - * [ActiveState](https://activestate.com) - [blog](https://www.activestate.com/blog/2018/03/reproducible-builds-introducing-predictability-your-pipeline) - [github](https://github.com/ActiveState) - * [Apex](https://apex.sh/) - * [NxTide] (https://nxtide.com/) - * [Blue Flag Consulting](https://blueflag.consulting/) - * [Bold Commerce](https://boldcommerce.com/careers/) - * [Buf](https://buf.build/) - * [ChainSafe Systems](https://chainsafe.io/) - [github](https://github.com/chainsafesystems) - * [district m](https://www.districtm.net) - [jobs](https://districtm.net/en/careers/) - * [Ecobee](https://www.ecobee.com) - * [Greenfield Labs / Zenreach](https://zenreach.com) - [jobs](https://www.zenreach.com/careers/) - * [Go2Mobi](http://www.go2mobi.com/) - [HN](https://news.ycombinator.com/item?id=10660847) - * [Hootsuite](https://hootsuite.com/) - * [Horizon](https://horizon.io) - * [Index Exchange](https://www.indexexchange.com) - [jobs](https://www.indexexchange.com/careers/) - * [Insights.gg](https://insights.gg/) - [jobs](https://angel.co/company/insights-pro-gg/jobs) - * [Kira Systems](https://kirasystems.com/) — [jobs](https://kirasystems.com/careers/) - * [Klei Entertainment](https://klei.com) - [jobs](https://klei.com/careers) - * [KOHO](https://www.koho.ca/) - [jobs](https://www.koho.ca/careers) - * [League](https://league.com) - [jobs](https://league.com/careers-at-league/) - * [Lendesk](https://lendesk.com) - [jobs](https://lendesk.com/careers) - * [Lightspeed](https://www.lightspeedhq.com/) - [jobs](https://www.lightspeedhq.com/careers/openings/?office=canada&department=technology) - * [LoginRadius](https://www.loginradius.com/) - [Blog](https://www.loginradius.com/engineering/blog/) - [Github](https://github.com/LoginRadius) - * [Manifold](https://manifold.co) - * [NV Digital](https://www.nvdigital.co/) - * [Obkio](https://obkio.com/) - * [Pressly](https://www.pressly.com/) - [github](https://github.com/goware/httpcoala) - * [Sendwithus](https://sendwithus.com) - * [SweetIQ](https://sweetiq.com/) - [jobs](https://sweetiq.com/about/careers-2/) - * [ThinkSquare](https://www.thinksquare.io) - * [Tidal Migrations](https://tidalmigrations.com/) - * [Blendibox](https://www.blendibox.com.br/) - * [Tulip](https://tulip.com/) - [jobs](https://tulip.com/about/careers/) - * [Wattpad](https://www.wattpad.com/) - * [500px](https://500px.com) - [blog](https://developers.500px.com/how-500px-serves-up-over-500tb-of-high-res-photos-fa81a376c594#.35tz2wtg2) - [github](https://github.com/500px) - * [Qlik](https://www.qlik.com) - [jobs](https://www.qlik.com/us/company/careers/job-listings?overridedefault=true&department=R%2526D&country=-1) - [github](https://github.com/qlik-oss) - -## Chile - * [Prey](https://preyproject.com) - [blog](https://preyproject.com/blog) - [github](https://github.com/prey) - * [Webdox](http://www.webdox.cl) - -## China - * [Baidu](https://www.baidu.com/) - * [Alibaba](https://www.alibaba.com/) - * [Xiaomi](https://mi.com/) - * [Tencent](https://intl.cloud.tencent.com/) - * [163yun](http://www.163yun.com/) - [github](https://github.com/163yun) - Netease Public Cloud - * [BaishanCloud](https://en.baishancloud.com/) - * [ByteDance](https://www.bytedance.com) - * [Ciprun](http://www.ciprun.com) - * [CS2C](http://www.cs2c.com.cn) - [github](https://github.com/openkylin) - * [deepin](http://deepin.org/) - [github](https://github.com/linuxdeepin) - a linux distribution aiming to provide an elegant desktop - * [EasyAR](https://www.easyar.com/) - * [Feiyu](http://www.feiyu.com/) - * [FunPlus](http://www.funplus.com/en/) - We Create Leading Innovative and Fun Experiences Worldwide - * [FutureBots](http://www.futurebots.cn/) - * [iDCOS](http://www.idcos.com/) - - [CloudBoot](http://www.idcos.com/products/cloudboot) - * [Inke](http://inke.com/) - the most popular broadcast platform - * [Kidswant](https://www.haiziwang.com/) - * [KLOOK](https://www.klook.com/) - * [MegaEase](http://www.megaease.com/) - * [Megvii](https://www.megvii.com/) - * [Mili](https://5imili.github.io) - * [MobiExchanger](http://www.mobiexchanger.com/) - Mobile Internet advertising company - * [Momenta](https://www.momenta.ai/) - * [MZD](https://www.xiaoenai.com/) - [github](https://github.com/xiaoenai) - * [OPPO](https://www.oppo.com) - * [Qiniu](http://www.qiniu.com/) - [github](https://github.com/qiniu) - Qiniu builds and operates one of the largest public cloud services in China, with millions of code written in Go since 2011. - * [Rainbond](http://www.rainbond.com) - [github](https://github.com/goodrain/rainbond) - Rainbond is an application centric PaaS - * [SenseTime](https://www.sensetime.com) - a global leading A.I. company - * [Shihuo](https://www.shihuo.cn/) - [github](https://github.com/shihuo-cn) - * [Teambition](https://www.teambition.com) - [github](https://github.com/teambition) - * [TiDB](https://www.pingcap.com/en/) - [tweet: Golang in TiDB](https://twitter.com/PingCAP/status/940503487086858240) - [github](https://github.com/pingcap/tidb) - TiDB is a distributed HTAP database compatible with the MySQL protocol - * [Udesk](https://www.udesk.cn/) - [github](https://github.com/udesk) - * [XiaoChuan](https://www.ixiaochuan.cn/) - * [Xiaoying](https://www.xiaoying.com/) - * [Xunlei](http://www.xunlei.com/) - * [YeePay](http://www.yeepay.com) - * [Yeeuu](https://www.yeeuu.com/) - * [Youmi](https://www.youmi.net/) - a global leading comprehensive mobile internet enterprise - * [cshome](https://www.cshome.com/) - * [DiDi](https://www.didiglobal.com/) - * [meicai](https://www.meicai.cn) - Catering supply chain service provider - * [360](https://www.360.com/) - * [xueqiu](https://www.xueqiu.com/) - * [Habby](https://habby.com/) - - -## Croatia - * [Crossvallia](https://crossvallia.hr/) - * [CROZ](https://www.croz.net) - [github](https://github.com/croz-ltd) - * [GoodCode](http://goodcode.io/) - [github](https://github.com/dobarkod) - * [Happening](https://happening.xyz/) - * [Kraken](https://krakensystems.co/) - * [Leapbit](https://www.leapbit.com/) - * [minus5](https://minus5.hr/) - [github](https://github.com/minus5) - * [Mosaic Croatia d.o.o.](https://mosaic.co/) - * [Nivas](http://www.nivas.hr/) - [github](https://github.com/nivas) - * [Rentlio](https://rentl.io) - [github](https://github.com/rentlio) - * [Sartura](https://www.sartura.hr/) - [github](https://github.com/sartura) - * [SedamIT](https://www.sedamit.hr/) - * [Syntio](https://www.syntio.net/) - [github](https://github.com/syntio) - * [Pointer](https://pointer.hr/hr/naslovna/) - -## Colombia - * [Wawandco](https://wawand.co) - [github](https://github.com/wawandco) - -## Denmark - * [Onlime](https://www.onlime.dk/) - * [SYBO Games](http://sybogames.com) - * [Vivino](https://www.vivino.com) - * [ZeroNorth](https://zeronorth.com/) - -## Estonia - * [Wallester](https://wallester.eu) - [github](https://github.com/wallester) - -## Finland - * [Alma Media](https://www.almamedia.fi/en/) - Media/Publishing company. [Twitter](https://twitter.com/almadevelopers) - -## France - * [Blog lecoinoccasion](https://blog.lecoinoccasion.fr/) - * [Accenta](https://www.accenta.ai/) - * [Algolia](https://algolia.com) - * [Batch.com](https://batch.com) - * [Containo.us](https://containo.us/) - * [Crisp](https://crisp.chat/) - * [crème de la crème](https://cremedelacreme.io/) - * [Cycloid](https://www.cycloid.io/) - [github](https://github.com/cycloidio) - [blog](https://blog.cycloid.io) - * [Digikong](http://digikong.io) - * [Equisense](http://www.equisense.com/en/) - * [Eleven Labs](http://eleven-labs.com/) - * [Fabriks](https://fabriks.net) - * [HAProxy Technologies](https://www.haproxy.com/) - [github](https://github.com/haproxytech) - * [Heetch](https://heetch.com) - [github](https://github.com/heetch) - * [IoThings](https://iothings.fr) - * [IRI France](http://www.iri-labs.com) - * [Leboncoin](http://lecoinoccasion.fr) - [github](https://github.com/leboncoin) - [blog](https://medium.com/leboncoin-engineering-blog) - * [LibMed](https://www.libertymedical.fr) - * [Molotov TV](http://www.molotov.tv) - * [Objenious](http://www.objenious.com) - * [OneStock](https://www.onestock-retail.com/en/) - * [Orange](http://www.orange.com) - * [ProcessOne](https://www.process-one.net) - * [PSA](https://www.groupe-psa.com/en) - [github](https://github.com/ekara-platform/) - * [Rive](http://app.rive.world) - * [Scaleway](https://www.scaleway.com) - [github](https://github.com/scaleway) - [blog](https://blog.scaleway.com) - * [Sendinblue](http://www.sendinblue.com/) - * [Sfeir](https://sfeir.com) - * [Synthesio](https://www.synthesio.com/) - * [Teads.tv](http://teads.tv/) - * [TF1](https://www.groupe-tf1.fr/en) - * [Ulule](https://ulule.com/) - [github](https://github.com/ulule/) - * [Veepee](http://vente-privee.com) - [github](https://github.com/vente-privee) - [blog](https://medium.com/@vptech) - * [Zenly](https://zen.ly/) - * [teckinside](http://teckinside.com/) - - -## Germany - * [Applied Go](https://appliedgo.com) - [blog](https://appliedgo.net) - * [Bürkert](https://www.burkert.com/en/) - * [Cloudogu](https://www.cloudogu.com) - [github](https://github.com/cloudogu) - * [Doozer](https://www.doozer.de) - [github](https://github.com/doozer-de) - * [Centrifuge](http://centrifuge.one) - [github](https://github.com/centrifuge) - * [Delivery Hero](https://www.deliveryhero.com/) - * [EGYM](https://www.egym.de/) - [Blog](https://code.egym.de/) - * [ESG Book](https://www.esgbook.com/) - * [ESONO AG](https://www.esono.de/) - * [FastBill](https://www.fastbill.com/) - * [Fraugster](https://fraugster.com/) - * [Friendsurance](https://www.friendsurance.de/) - * [fromAtoB](https://www.fromatob.com/) - [blog](https://eng.fromatob.com/blog/) - * [HaCon Ingenieurgesellschaft mbH](http://hacon.de/) - * [HelloFresh](http://www.hellofreshgroup.com/) - [github](https://github.com/hellofresh) - * [Herdius](https://www.herdius.com/) - [github](https://github.com/herdius) - * [HolidayCheck](https://www.holidaycheck.de/) - [github](https://github.com/holidaycheck) - [Blog] - * [IDAGIO](https://www.idagio.com/) - * [Industrial-DevOps](https://www.industrial-devops.org/) - [gitlab](https://git.industrial-devops.org/titan/DataFlowEngine/flowengine-go) - * [JustWatch](https://www.justwatch.com/us) - [HN](https://news.ycombinator.com/item?id=10658330) - * [KI Labs](https://www.ki-labs.com/) - * [loodse](https://loodse.com/) - [github](https://github.com/kubermatic/) - * [limango](https://www.limango.de/) - * [Meplato](https://www.meplato.com/) - * [Naga Virtual](https://nagavirtual.com/) - * [Native Instruments](https://www.native-instruments.com/) - [github](https://github.com/nativeinstruments) - * [networkteam GmbH](https://networkteam.com/) - [github](https://github.com/networkteam?language=go) - * [OptioPay](https://www.optiopay.com) - * [ownCloud](https://owncloud.org) - [github](https://github.com/owncloud?language=go) - * [Posteo](https://posteo.de/en) - Green, secure, ad-free email service - * [PubNative](https://www.pubnative.net/) - [github](https://github.com/pubnative) - * [simplesurance](https://www.simplesurance.com/) - * [Sixt](https://www.sixt.com) - * [Spreadshirt](https://spreadshirt.com) - * [solarisBank](https://solarisbank.com) - * [SoundCloud](https://soundcloud.com) - [blog](https://developers.soundcloud.com/blog/go-at-soundcloud) - * [SumUp](https://sumup.com) - * [Streetspotr](http://streetspotr.com) - [blog](https://thcyron.de/2015/go-at-streetspotr.html) - [tweet](https://twitter.com/thcyron/status/372350650580865024) - * [Tourlane](https://www.tourlane.de) - * [trivago N.V.](https://www.trivago.com/) - [blog](https://tech.trivago.com/) - [github](https://github.com/trivago) - * [Weaveworks](http://weave.works) - * [Zalando SE](https://www.zalando.com) - [blog](https://jobs.zalando.com/tech/blog/) - * [Onefootball](http://onefootball.com) - * [Sudokoin](http://sudokoin.com) - * [HÄVG Rechenzentrum GmbH](https://www.haevg-rz.de/) - [blog](https://devblog.haevg-rz.de/) - [github](https://github.com/haevg-rz) - -## Greece - * [Beat](https://thebeat.co) - * [Skroutz](https://www.github.com/skroutz/) - * [BestPrice](https://www.bestprice.gr) - * [Inaccess](https://www.inaccess.com) - -## Hong Kong - * [PassKit](https://passkit.com/) - [github](https://github.com/PassKit) - * [Lalamove](https://github.com/lalamove) - * [Sandbox VR](https://sandboxvr.com) - -## Hungary - * [Pronovix](http://pronovix.com/) - [github](https://github.com/Pronovix) - -## India - * [AirCTO](https://aircto.com) - * [AmberStudent](https://amberstudent.com) - * [Betacraft](http://www.betacraft.co/) - * [BookMyShow](http://www.bookmyshow.com/) - * [Blogger Cage](https://www.bloggercage.com) - * [BLITZPOKER](https://www.blitzpoker.com/) - * [Carmatec](https://www.carmatec.com/golang-development-company/) - * [CRED](http://cred.club/) - * [C42 Engineering](http://c42.in/) - * [Cralina](http://cralina.com/) - * [CodeIgnition](http://codeignition.co/) - [twitter](https://twitter.com/AjeyGore/status/667515185486102529) - * [Company 0](https://www.companyzero.com/) - * [Cloudsdeal](https://www.cloudsdeal.com/) - * [Continuum Managed Solutions](https://continuum.net) - * [Crowdfire](https://www.crowdfireapp.com/) - * [Tasker Project Management Tool](https://task.usercv.com) - * [CoderCV.com Freelancer Marketplace](https://codercv.com) - * [DeHaat](https://agrevolution.in) - Full Stack Agri Tech Solutions - * [DeepSource](https://deepsource.io) - Automated code review tool for developers - * [Dunzo](https://www.dunzo.com) - * [EasyAcco](https://www.easyacco.com) - * [Euphoros Limited](https://www.euphoros.com) - * [Exotel](http://exotel.in) - [website](http://www.gophercon.in/#sponsor) - * [FamPay](https://fampay.in/) - India’s first neobank for teenagers and their families. - * [Fastah (Blackbuck Computing)](https://angel.co/blackbuck-computing/) - * [FStack (Golang Consulting)](http://fstack.co/) - * [Fynd](http://fynd.com/) - * [GeekTrust](http://geektrust.in/) - * [GetMega](https://getmega.com/) - * [Gloop](http://gloop.io/) - * [Gojek](https://github.com/gojek) - * [Gradeup](https://github.com/gradeup) - * [Guavus](https://www.guavus.com) - * [Halodoc](https://www.halodoc.com) - * [Hasura](https://hasura.io) - * [Hotstar](https://www.hotstar.com/) - * [INDmoney](https://www.indmoney.com/) - * [Instamojo](https://www.instamojo.com/) - * [Improwised Technologies](https://www.improwised.com) - * [Ithaka](http://ithaka.travel) - * [Josh Software](http://www.joshsoftware.com/) - * [JusTickets - built with Go](https://www.justickets.in/cities) - * [Kayako](http://www.kayako.com/) - * [LiteBreeze](https://litebreeze.com/) - * [MakeMyTrip](https://makemytrip.com/) - * [South Tourism](https://southtourism.in/) - * [Mailazy](https://mailazy.com/) - * [Mindbowser](http://mindbowser.com/) - * [Mindship](http://www.mindship.io) - * [Myntra](https://www.myntra.com/) - * [Nazara Games](https://www.nazara.com/) - * [Noticeboard](https://www.noticeboard.tech/) - * [teckinside](http://teckinside.com/) - * [Onet](https://www.onet.io) - * [OpenEBS](https://www.openebs.io) - Containerized,opensource storage for containers - * [Pincode.app - Local Social Network](https://pincode.app) - * [Propebbles](http://www.propebbles.com/) - * [Provlem.com](http://www.provlem.com/) - * [PubMatic](https://pubmatic.com/) - AdTech company - * [Qube Cinema](https://www.qubecinema.com/) - * [Qwentic](http://www.qwentic.com) - A Golang specialized software development company - * [Qwinix](https://www.qwinixtech.com/) - * [RevvSales](https://www.revvsales.com/) - * [Rapyuta Robotics](https://www.rapyuta-robotics.com/) - * [Razorpay](https://razorpay.com/) - * [RenoApp](https://www.renoapp.in/) - * [Ruhi handblock Printers](http://ruhihandblockprinters.com/) - * [Sahaj Software Solutions](http://www.sahajsoft.com/) - * [Saltside Technologies AB](http://www.saltside.se/) - * [Saven Technologies Ltd](http://www.saven.in/) - * [Sendinblue](http://www.sendinblue.com/) - * [SellerApp](https://www.sellerapp.com/) - * [Sezzle](https://sezzle.in/) - * [Siminars](http://siminars.com) - * [Singulerp](https://singulerp.com) - * [Skit.ai](https://skit.ai) - * [SocialCops](https://socialcops.com) - [engineering page](https://socialcops.com/careers/engineering/) - * [SoStronk](https://www.sostronk.com/) - * [Spoors](https://www.spoors.io/) - * [Squadcast](https://www.squadcast.com) - A Site Reliability Engineering (SRE) Product company - * [Swiggy](http://www.swiggy.com/) - * [Synerzip](http://synerzip.com/) - * [Tarkalabs](https://tarkalabs.com/) - * [Techequity Technologies](http://www.techequity.in/) - * [ThoughtBox Online Services Pvt Ltd](https://www.thoughtbox.io/) - A FinTech Solution Provider - * [ThoughtWorks](https://thoughtworks.com/) - * [Unbxd](http://unbxd.com) - * [University Living](https://www.universityliving.com/) - * [UserCV.com Freelancer Marketplace](https://usercv.com) - * [Verloop.io](https://verloop.io) - An AI chat bot company - * [Vernacular.ai](https://vernacular.ai) - * [WazirX](https://wazirx.com/) - * [WebAuditor](https://webauditor.co/) - * [Zomato](https://www.zomato.com/) - * [Zerodha](https://kite.zerodha.com/) - * [ZopSmart](https://zopsmart.com/) - -## Indonesia - - * [123 Berita](https://www.123berita.com) - * [Auditsi Executive Recruitment Services](http://auditsi.com) - * [Amartha](https://amartha.com/id_ID/) - * [Alphamor](https://alphamor.id) - * [Bareksa](https://www.bareksa.com/) - * [Bhinneka](http://www.bhinneka.com/) - * [BlockchainZoo](https://blockchainzoo.com/) - * [Brankas](https://brank.as) - * [Brodo](http://www.bro.do/) - * [Bukalapak](http://bukalapak.com) - * [CICIL.CO.ID](https://cicil.co.id) - * [Codemi Learning Management System](http://codemi.co.id) - * [DigiAset](http://www.gadgethariini.com) - * [EACIIT](http://eaciit.com) - * [Emtrade](https://emtrade.id) - * [Gilkor](https://gilkor.com) - * [GoApotik](https://www.goapotik.com) - * [GOJEK](https://www.gojek.io/) - * [Graboards](https://graboards.com/) - * [Guteninc](http://guteninc.com) - * [Halodoc](https://www.halodoc.com) - * [HappyFresh Indonesia](https://www.happyfresh.id) - * [Ice House Corp](https://www.icehousecorp.com) - * [Jejak Techno](https://www.jejaktechno.com/) - * [Kelir.tv](http://kelir.tv) - * [Koinworks](https://koinworks.com) - P2P Lending Platform. - * [Korina](http://sewamobilsolo.net) - * [Kudo](https://kudo.co.id) - * [kumparan](https://kumparan.com) - * [Kurio](https://kurio.co.id) - * [Lazada](http://www.lazada.co.id) - * [Kucari.com](http://www.kucari.com) - * [LinkAja](https://linkaja.id) - * [LionJobs](http://lionjobs.com) - * [Matahari Mall](http://mataharimall.com) - * [Magicsoft Asia Systems](http://magicsoft-asia.com) - * [Medcampus](https://www.medcampus.io) - * [Michael Page Indonesia](http://www.michaelpage.co.id) - * [Midtrans Payment Gateway](http://midtrans.com) - * [meTube.id](https://www.metube.id) - * [Minyak Telon](https://doodle.co.id) - * [Nodeflux](https://www.nodeflux.io/) - * [PDAM Kab. Batang](https://tangki.pdambatang.co.id/) - * [Pinhome](https://www.pinhome.id) - * [Pinjam Indonesia - FinTech](https://pinjam.co.id) - * [Pintu Magang - Jobs for Student](http://pintumagang.jktserver.com) - * [President University](http://presuniv.com) - * [Qasico Teknologi Indonesia](https://qasico.com) - * [Qasir.id](https://www.qasir.id/) - * [Qiscus](https://www.qiscus.com) - * [QUPAS.ID](https://www.qupas.id) - * [Ralali](https://www.ralali.com/) - B2B Marketplace Platform - * [Raydar](http://goraydar.com) - * [RebelWorks](http://www.rebelworks.io) - * [RedtreeMobile](http://redtreemobile.com) - * [Reservasi](https://www.reservasi.com/id-id) - * [Rimbun Job Agency](http://www.rimbunjob.com) - * [RSU Anwar Medika](http://rsanwarmedika.com) - * [Ruangguru](https://ruangguru.com) - * [Sorabel by Sale Stock](https://www.sorabel.com) - * [SAP Indonesia](http://go.sap.com/corporate/en/company/office-locations/indonesia.html) - * [Tokopedia](http://tokopedia.com) - * [Tech in Asia Indonesia](https://id.techinasia.com) - * [Valutac](https://valutac.com) - * [Tugujatim](https://tugujatim.id) - * [Tugumalang](https://tugumalang.id) - * [Deepta](https://deepta.club) - * [Visinesia Global Trade](https://visinesiaglobaltrade.com) - * [Ourintake](https://ourintake.my.id) - * [Mangko](https://mangko.net) - -## Iraq - * [eSITE](https://esite-iq.com/) - -## Iran - * [Kamva](https://kamva.ir/) – Kamva eCommerce Platform [github](https://github.com/kamva/) - * [Idpay](https://idpay.ir/) - bank gateways and a stable billing service in order to connect payments. - * [IranBooking](https://www.iran-booking.com) - Online booking system for hotels in Iran - * [QuizOfKings](https://quizofkings.com) - Online trivia game among the most popular mobile game in iran - * [open market](https://openmarket.ir/) - best online home store. - * [ManaGroup](https://www.managroup.co/) - [github](https://github.com/managroup) Iranian Payment And Traveling Solution 💸✅🚀 - * [Emji](https://emji.app/) - Emji is a new refined social networking platform aimed at simplicity and connectivity - * [Clickyab](https://clickyab.com/) - Clickyab is diffrent online advertising & digital media agency - * [Sazito](https://sazito.com/) - Sazito is multi-functional tools to build and manage your online store. - * [Aparat](http://www.aparat.com) -- Most popular video sharing platform in Iran - * [Asan Pardakht](http://asanpardakht.ir/) -- Pay Smarter. Pay Simpler. Pay Anywhere! - * [SabzCity](https://sabz.city/) - [github](https://github.com/sabzcity/) - * [Bahamta](https://bahamta.com/) - Fintech company. - * [flytoday](https://flytoday.ir/) - best online travel agency in Iran - * [Taskmiran](https://taskmiran.com/) - best Xiaomi warranty in Iran - * [Tahvienovin](https://tahvienovin.com/) - number one chiller producer in Iran - * [Bilitkade](https://bilitkade.com/) - Travel and Ticketing Platform - * [Telmaperfume](https://telmaperfume.com/) - Promotional Gifts. - * [Giftsbox](https://happymotherday.net/) - Promotional Mothers Day Gifts. - * [Snapp](https://snapp.ir/) - Snapp is a web and mobile ride-hailing platform in Iran - * [Parsaspace](https://parsaspace.com) - Parsaspace is an iranian storage as a service - * [Shafa.clinic](https://Shafa.clinic/) - best medical laser service in Iran - * [Cafe Bazaar](https://cafebazaar.ir/?l=en/) - Iranian Android marketplace - * [Alibaba Travels Co.](https://alibaba.ir/) - [(Github)](https://github.com/alibaba-go) - Iranian online travel agency - -## Ireland - * [EXADS](http://exads.com/) - * [Intercom](http://intercom.io/) - * [Teamwork](http://teamwork.com/) - [blog](http://engineroom.teamwork.com/our-future-stack-or-why-we-love-knockout-coffeescript-redis-and-go/) - * [Nitro](https://gonitro.com) - We make document productivity easy, powerful, affordable, and available to all. - -## Israel - * [353solutions](http://353solutions.com) - * [AppsFlyer](https://www.appsflyer.com) - * [Aqua Security](https://www.aquasec.com) - * [BigPanda](http://bigpanda.io) - * [Bottomline Technologies](https://www.bottomline.com) - * [Bringg](https://www.bringg.com) - * [Check Point](https://www.checkpoint.com/) - * [Cloud Invent](http://cloudinvent.com/) - * [Cloudinary](https://cloudinary.com/) - * [CTERA](https://www.ctera.com/) - * [Cyren](https://www.cyren.com) - * [Dragontail Systems](https://www.dragontailsystems.com) - * [Domino's Pizza](https://dominos.co.il) - * [Elastifile Ltd](http://elastifile.com) - * [Ensilo](https://www.ensilo.com/) - * [EyeSight](http://eyesight-tech.com) - * [Fiverr](http://Fiverr.com/) - * [Firedome](https://firedome.io) - * [Gett](http://gett.com/) - * [HERE Mobility](https://mobility.here.com/) - * [Intuit](http://intuit.com/) - * [ironSource](http://www.ironsrc.com) - * [Jewish Interactive](http://jewishinteractive.org) - * [JFrog](https://www.jfrog.com/) - [github](https://github.com/JFrogDev/jfrog-cli-go) - * [Firedome](https://firedome.io/) - [github](https://github.com/firedome) - * [Iguazio](https://www.iguazio.com/) - Data science and analytics PaaS - * [v3io](https://github.com/v3io) - Iguazio open source - * [nuclio](https://github.com/nuclio/nuclio) - Nuclio Serverless project - * [JobJob](http://JobJobapp.com) - * [LivePerson](https://www.liveperson.com) - * [Make My Day](https://www.makemydayapp.com/) - * [Medtronic](https://www.medtronic.com/) - * [Mathematic.ai](https://www.mathematic.ai) - * [Nexar](https://www.getnexar.com/) - * [Nexite](https://www.nexite.io/) - * [Panoply](https://panoply.io­) - * [playtech](https://www.playtech.com/) - * [Peer5](https://www.peer5.com/) - * [PlanGrid](https://www.plangrid.com/) - * [Proofpoint](https://proofpoint.com) - * [Protected Media](http://www.protected.media) - * [PUB+](http://pubplus.com/) - * [PushApps](https://www.pushapps.mobi/) - * [Rimoto](http://www.rimoto.com/) - * [Rounds](http://www.rounds.com) - * [SentinelOne](https://www.sentinelone.com/) - * [sigmadots](https://sigmadots.com/) - * [Soluto](https://www.solutotlv.com/) - * [SimilarWeb](https://www.similarweb.com/) - * [spot.im](https://www.spot.im/) - * [Stratoscale](http://www.stratoscale.com) - [github](https://github.com/Stratoscale) - * [StreamRail](https://www.streamrail.com/) - * [TechedUp](http://www.techedup.net) - ([Blog](http://blog.techedup.net/category/go/)) - * [Tikal](https://www.tikalk.com/) - * [Tufin](https://www.tufin.com/) - * [Twistlock](https://www.twistlock.com) - * [uponit](https://uponit.com/) - * [Venn](https://global.venn.city/) - * [Yodas](https://yodas.com) - * [Yotpo](https://www.yotpo.com/) - * [ZipRecruiter](https://www.ziprecruiter.com/) - * [MinuteMedia](https://www.minutemedia.com/) - -## Italy - * [Oxequa](http://www.oxequa.com) - ([Realize](https://github.com/oxequa/realize), [Grace](https://github.com/oxequa/grace)) - * [Qurami](http://www.qurami.com) - [github](https://github.com/qurami) - * [Sorint.lab](https://www.sorint.it) - [github](https://github.com/sorintlab) - * [Trenìt!](http://www.trenit.info) - ([FB post](https://www.facebook.com/trenitapp/posts/907728379283787)) -- Most popular mobile app for Italian trains schedules - * [Develer](https://www.develer.com) - * [Qlik](www.qlik.com) - [jobs](https://www.qlik.com/us/company/careers/job-listings?overridedefault=true&department=R%2526D&country=-1) - * [Wellnet](https://www.wellnet.it) - * [Pixartprinting](https://www.pixartprinting.com/) - * [Overzoom](https://www.overzoom.it) - -## Japan - * [3-shake, Inc.](https://www.3-shake.com/) - * [ACALL, Inc.](https://corp.acall.jp/) - * [and factory, Inc.](https://andfactory.co.jp/) - * [ANDPAD Inc.](https://andpad.co.jp/) - * [Appify Technologies, Inc.](https://appify-inc.com/) - * [gqlgo](https://github.com/gqlgo) - GraphQL Go organization - * [aptpod, Inc.](https://www.aptpod.co.jp/) - * [AtCoder, Inc.](https://atcoder.jp/) - * [Atrae, Inc.](https://atrae.co.jp/) - * [Axsh, Co.](https://axsh.jp/) - * [LiquidMetal](https://www.liquidmetal.io/) is a web service and a hardware appliance that together bring continuous automated testing to network system operation. - * [Azoop Co., Ltd.](https://azoop.co.jp/) - * [Baseconnect, Inc.](https://company.baseconnect.in/) - * [BASE BANK, Inc.](https://basebank.jp/) - * [Belong Inc.](https://about.belong.co.jp/) - * [Bengo4.com,Inc.](https://corporate.bengo4.com/) - * [Bitkey Inc.](https://bitkey.co.jp/) - * [CloudSign](https://www.cloudsign.jp/) - * [CastingONE Inc.](https://casting-one.jp/) - * [Check Inn, Inc.](https://checkinn.jp/) - * [Chompy, Inc.](https://chompy-inc.com/) - * [Cluster, Inc.](https://corp.cluster.mu) - * [Cloud Ace, Inc.](https://www.cloud-ace.jp/) - * [Clover Lab.,inc.](https://cloverlab.jp/) - * [Connehito Inc.](https://connehito.com/) - * [Cookpad Inc.](https://info.cookpad.com/en) - * [CyberAgent, Inc.](https://www.cyberagent.co.jp/) - * [PipeCD](https://pipecd.dev/) - Continuous Delivery for Declarative Kubernetes, Serverless and Infrastructure Applications - * [ecs-formation](https://github.com/openfresh/ecs-formation) - ecs-formation is a tool for defining several Docker continers and clusters on Amazon EC2 Container Service(ECS) - * [plasma](https://github.com/openfresh/plasma) - plasma is event push middleware by using gRPC stream - * [Cybozu](https://www.cybozu.com) - [github](https://github.com/cybozu-go) - * [DeNA Co.,Ltd.](https://dena.com) - * [D.A.Consortium Inc.](https://www.dac.co.jp/) - * [DIP Corporation.](https://www.dip-net.co.jp) - * [DMM.com Group](https://dmm-corp.com/) - * [Dr.'s Prime, Inc.](https://drsprime.com/company/) - * [D2C Inc.](https://www.d2c.co.jp/) - * [Eichiii, Inc.](https://eichiii.com/) - * [enish,Inc.](https://www.enish.jp/) - * [eureka](https://eure.jp) - * [feedtailor](https://www.feedtailor.jp/) - * [Fenrir](http://www.fenrir-inc.com/jp/) - * [Finatext Ltd.](https://finatext.com/) - * [Fixpoint, Inc.](https://www.fixpoint.co.jp/) - * [Kompira cloud](https://cloud.kompira.jp/) - Automation service for system operator - * [Flatt](https://flatt.tv/) - Live Commerce Application - * [FreakOut, Inc.](https://fout.co.jp/) - * [freee K.K.](https://corp.freee.co.jp/) - * [Fukurou Labo, inc.](https://fukurou-labo.co.jp/) - * [Fusic Co., Ltd.](https://fusic.co.jp) - * [Future Architect](http://www.future.co.jp/architect/) - * [Vuls](https://github.com/future-architect/vuls) - Vulnerability scanner for Linux/FreeBSD, agentless, written in Go - * [Fuller, Inc.](https://fuller-inc.com/) - * [Gaudiy, Inc.](https://hp.gaudiy.com/) - * [GameWith, Inc.](https://gamewith.co.jp/) - * [Gemcook, Inc.](https://gemcook.com/) - * [Giftee, Inc.](https://giftee.co.jp/) - * [GMO Pepabo, Inc.](https://pepabo.com/) - * [GOODWITH LLC.,](https://www.goodwith.tech/) - * [Dockle](https://github.com/goodwithtech/dockle) - Container Image Linter for Security, Helping build the Best-Practice Docker Image, Easy to start - * [Graffer, Inc.](https://graffer.jp/) - * [Groovenauts, Inc.](https://www.groovenauts.jp/) - * [Gunosy Inc.](https://gunosy.co.jp/) - * [Gurunavi, Inc.](https://gurunavi.com/) - * [Hatena](http://hatenacorp.jp/) - * [Mackerel](https://mackerel.io) - Monitoring as a Service ([github](https://github.com/mackerelio)) - * [HEARTBEATS](https://heartbeats.jp/) - * [happo-agent](https://github.com/heartbeatsjp/happo-agent) - Yet another Nagios nrpe - * [HENNGE K.K.](https://hennge.com/global/) - * [HiCustomer](https://hicustomer.jp/) - a Customer Success management platform - * [Howtelevision, Inc.](https://howtelevision.co.jp/) - * [HRBrain, Inc.](https://www.hrbrain.co.jp/) - * [Internet Initiative Japan Inc.](http://www.iij.ad.jp) - * [IRIAM Inc.](https://www.live.iriam.com/) - * [istyle Inc.](http://www.istyle.co.jp/) - * [JapanTaxi Co.,Ltd.](https://japantaxi.co.jp/) - * [JX Press Corporation](https://jxpress.net/) - * [Kanmu, Inc.](https://kanmu.co.jp/) - * [KAYAC Inc.](https://www.kayac.com/) - [github](https://github.com/kayac) - * [KLab Inc.](http://www.klab.com/jp/english/) - * [Knowledge Work Inc.](https://kwork.studio/) - * [KRPEO](https://rikitake.jp/) - * [Kyash Inc](https://kyash.co/en/) - * [LayerX, Inc](https://layerx.co.jp/) - * [LEAN BODY Inc.](https://lean-body.co.jp/) - * [Link-U Inc.](https://www.link-u.co.jp/) - * [Linkbal Inc.](https://linkbal.co.jp/) - * [LINE](https://linecorp.com/) - * [Liquid Inc.](https://liquidinc.asia/) - * [Livesense Inc.](https://livesense.co.jp/) - [github](https://github.com/livesense-inc) - * [LOB, Inc.](https://www.lob-inc.com/) - [github](https://github.com/lob-inc) - * [M3](https://corporate.m3.com/) - * [Makuake, Inc.](https://www.makuake.co.jp/) - * [mediba](http://www.mediba.jp/) - * [Mercari, Inc.](https://about.mercari.com/) - * [gaurun](https://github.com/mercari/gaurun) - Gaurun is the general push notification server in Go. - * [widebullet](https://github.com/mercari/widebullet) - Widebullet is an API gateway with JSON-RPC. - * [go-httpdoc](https://github.com/mercari/go-httpdoc) - Golang package for generating API documentation from httptest. - * [Datastore](https://github.com/mercari/datastore) - (AE|Cloud) Datastore Wrapper. - * [yo](https://github.com/mercari/yo) - yo is a command-line tool to generate Go code for Google Cloud Spanner. - * [go-dnscache](https://github.com/mercari/go-dnscache) - Go package for caching DNS lookup results in memory. - * [grpc-http-proxy](https://github.com/mercari/grpc-http-proxy) - A reverse proxy server which translate JSON HTTP requests to gRPC calls based on protoreflect. - * [go-httpstats](https://github.com/mercari/go-httpstats) - Go package for reporting HTTP stats. - * [certificate-expiry-monitor-controller](https://github.com/mercari/certificate-expiry-monitor-controller) - -Certificate Expiry Monitor Controller monitors the expiration of TLS certificates used in Ingress. - * [tfnotify](https://github.com/mercari/tfnotify) - A CLI command to parse Terraform execution result and notify it to GitHub. - * [imageflux-cli](https://github.com/mercari/imageflux-cli) - Imageflux Client written in Go. - * [Merpay, Inc.](https://merpay.com/) - * [MNES, Inc.](https://mnes.life/) - * [Miniascape Co., Ltd.](https://www.miniascape.co.jp/) - * [Minna Bank, Ltd.](https://www.minna-no-ginko.com/) - * [Mirrativ, Inc.](https://www.mirrativ.co.jp/) - * [MIXI, Inc.](https://mixi.co.jp/en/) - * [Mobingi](https://mobingi.com/) - [github](https://github.com/mobingi) - * [Mokelab](https://mokelab.com) - [github](https://github.com/mokelab-go/) - * [Momentum Inc.](https://www.m0mentum.co.jp/) - * [Money Forward, Inc.](https://corp.moneyforward.com/) - * [MF KESSAI, Inc.](https://corp.mfkessai.co.jp/) - * [Nagisa Inc.](https://nagisa-inc.jp/) - * [neuet, Inc.](https://neuet.com/) - * [Nikkei Inc.](https://hack.nikkei.com/blog) - * [nonpi Inc.](https://www.nonpi.com/) - * [NOT A HOTEL inc.](https://notahotel.com/) - * [Nulab](https://nulab-inc.com/) - [github](https://github.com/nulab) - * [O-KUN Inc.](https://o-kun.com/) - * [omeroid](https://www.omeroid.com/) - * [OPTiM Corporation](https://www.optim.co.jp/) - * [Origami Inc.](https://origami.com/) - * [PERSOL CAREER CO., LTD.](https://www.persol-career.co.jp/) - * [PicApp Inc.](http://picappinc.jp/) - * [pixiv Inc.](https://www.pixiv.co.jp/) - * [Play Technologies, inc.](https://play-tech.jp/) - * [Preferred Networks](https://www.preferred-networks.jp/en/) - * [SensorBee](https://github.com/sensorbee) - Lightweight streaming processing engine for IoT - * [Progate, inc.](https://prog-8.com/) - * [Quipper Ltd.](https://www.quipper.com) - * [Rakuten Inc.](https://rakuten.careers/) - Largest e-commerce, online bank, and credit card (by transaction value) company in Japan with many smaller online services and subsidiaries. - * [READYFOR INC.](https://corp.readyfor.jp/) - * [Repro Inc.](https://repro.io/) - * [Retail AI, Inc.](https://www.retail-ai.jp) - * [Retty Inc.](https://corp.retty.me) - * [redish Inc.](https://www.redish.jp) - Message delivery service on AWS Lambda - * [ROLLCAKE Inc.](https://rollcake.co/) - * [SAKURA Internet Inc.](https://www.sakura.ad.jp/) - [github](https://github.com/sakura-internet) - * [Arukas](https://arukas.io/en/) - [github](https://github.com/arukasio) - Docker Container Hosting - * [Web Accelerator](http://cloud.sakura.ad.jp/specification/web-accelerator/) - * [sakura.io](https://sakura.io/) - * [Sharedine](https://sharedine.me/) - * [SheepMedical](https://www.sheepmedical.com/) - * [Showcase Gig Inc.](https://www.showcase-gig.com/) - * [SMART EDUCATION, Ltd.](http://smarteducation.jp/) - * [KitS](http://kdkits.jp/) - * [Artpop!](http://kdkits.jp/materials/) - * [SmartShopping, Inc.](https://smartshopping.co.jp/) - * [SODA inc.](https://soda-inc.jp/) - [SNKRDUNK](https://snkrdunk.com/) is a Japan’s No.1 Sneaker & Streetwear C2C Marketplace. - * [Souzoh, Inc.](https://souzoh.com/) - * [Spectra, Inc.](https://spectra.tokyo/) - * [Speee, Inc.](https://speee.jp/) - * [STORES, Inc.](https://www.st.inc/) - * [TOPGATE](https://www.topgate.co.jp/) - * [Toreta, Inc.](https://corp.toreta.in/) - * [Ubie, inc.](https://ubie.life/) - * [Unipos Inc.](https://www.unipos.co.jp/) - * [UPSIDER, Inc.](https://corporatecard.up-sider.jp/) - * [VELTRA Corporation](https://www.veltra.com/) - * [Video Market Corporation](https://www.videomarket.co.jp/) - * [viviON, inc.](https://vivion.jp/) - * [Voicy, Inc.](https://corp.voicy.jp/) - * [VOYAGE GROUP](https://voyagegroup.com/) - * [VRize, Inc.](https://vrize.io/) - * [WACUL, Inc.](https://wacul.co.jp/) - * [Wantedly, Inc.](https://wantedlyinc.com/ja) - * [github](https://github.com/wantedly?language=go) - * [WealthPark, Inc.](https://wealth-park.com/en/corporate/careers/#engineering-department) - * [wesionaryTEAM](https://www.wesionary.team/) - * [XICA Inc.](https://xica.net/) - * [XSHELL](https://xshell.io) - * [Isaax](https://isaax.io) - * [IoTit Flashing tool](http://iotit.isaax.io) - * [Yahoo! JAPAN Corporation](https://yahoo.co.jp/) - * [Vald](https://vald.vdaas.org) - A highly scalable distributed fast approximate nearest neighbor dense vector search engine. - * [NGTD](https://github.com/yahoojapan/ngtd) - NGTD provides serving function for NGT. - * [gongt](https://github.com/yahoojapan/gongt) - NGT Go client library - * [Athenz](https://www.athenz.io) - Open source platform for X.509 certificate based service authentication and fine grained access control in dynamic infrastructures - * [Garm](https://github.com/yahoojapan/garm) - Kubernetes authorization webhook (SubjectAccessReview API) server for Athenz - * [Athenz Authorizer](https://github.com/yahoojapan/athenz-authorizer) - Athenz policy management library for golang - * [Athenz Client Sidecar](https://github.com/yahoojapan/athenz-client-sidecar) - An implementation of Kubernetes sidecar container to provide a common interface to retrieve authentication and authorization credential from Athenz server. - * [Athenz Authorization Proxy](https://github.com/yahoojapan/authorization-proxy) - An implementation of Kubernetes sidecar container to provide a common interface for API endpoint authentication and authorization. It caches the policies from Athenz, and provides a reverse proxy interface to control access on specific URL endpoints. - * [Yappli, Inc.](https://yappli.co.jp/) - * [ZOZO, Inc.](https://corp.zozo.com/) - -## Kazakhstan - * Kolesa LLC - microservices for classified ads websites and mobile applications backend ([Kolesa](http://kolesa.kz), [Krisha](https://krisha.kz), [Market](https://market.kz)) - * [Technodom Operator](https://www.technodom.kz) - eCommerce platform. - -## Korea (South) - * [ComTrue Technologies](http://comtrue.com/) - Network Packet Analyzer - * [Digitalidea](http://www.digitalidea.co.kr) - inhouse tool for VFX - * [FlyHigh](http://flyhigh-x.com/en/) - Information Security Solution - * [KonaCard](http://www.konacard.co.kr/) - Payment Service - * [Lazypic](https://lazypic.org) - Contents creation and support Solution - * [NHN Entertainment](http://nhnent.com/) - * [Quicket](http://m.bunjang.co.kr) - Image Proxy, Push, Messenger - * [Toast Cloud](https://toast.com/) - Public Cloud Service - * [Wemakeprice](http://www.wemakeprice.com) - CRM Solution - * [Gabia](https://www.gabia.com/) - Server monitoring solution - * [BankSalad](https://banksalad.com/) - Personal Finance Management Service - * [Daangn Market](https://www.daangn.com/) - Used trades between people in the same area - * [DelightRoom](https://alar.my/) - The world’s most annoying alarm clock - Alarmy - -## Lithuania - * [DATA-DOG](https://github.com/DATA-DOG) - -## Malaysia - * [MHub](https://mhub.my) - * [Revenue Monster](https://revenuemonster.my/) - * [iflix](https://piay.iflix.com) - Free and Subscription Video On Demand Service - * [AirAsia](https://www.airasia.com/) - -## Mexico - * [Conekta](https://www.conekta.com/) - Payment Service - * [Segundamano](https://www.segundamano.mx/) - * [Entropy](https://entropy.tech) - Ecommerce Marketing Optimization Platform. - * [Credijusto](https://engineering.credijusto.com/) - Financial Services - * [Tredicom](https://www.tredicom.com/) - B2B, EDI & Ecommerce Services - -## Middle-East - * [ThoughtBox Technologies](https://www.thoughtbox.io/) - A FinTech Solution Provider - -## Moldova - * [Emphatic Spark](http://emphaticspark.com/) - -## Morocco - * [Avito](http://www.avito.ma) - -## Nepal - * [wesionaryTEAM](https://www.wesionary.team/) - * [Leapfrog Technology](https://www.lftechnology.com/) - -## Netherlands - * [Aan Zee](https://www.aanzee.nl) - * [Albert Heijn](https://ah.nl) - * [BloomReach](https://www.bloomreach.com) - * [bol.com](https://www.bol.com) - * [booking.com](https://www.booking.com) - * [Bubble Shooter](https://www.bubbleshooter.net/) - * [Cloudbear](https://cloudbear.nl/) - [github](https://github.com/cbws) - * [Dataswimmer](https://www.dataswimmer.com/) - * [Datumprikker.nl](https://datumprikker.nl/) - * [FindHotel](https://www.findhotel.net/) - * [FLYR](https://www.flyr.com) - * [Housing Anywhere](https://housinganywhere.com/) - * [ISAAC](https://www.isaac.nl) - * [Jexia](http://jexia.com) - [github](https://github.com/jexia-inc) - * [Kickstox](https://kickstox.com) - * [Kopano](https://kopano.com) - [github](https://github.com/Kopano-dev) - * [localsensor](http://localsensor.com/) - * [MessageBird](https://www.messagebird.com/) - [github](https://github.com/messagebird) - * [Nerdalize](https://www.nerdalize.com/) - [github](https://github.com/nerdalize) - * [Nextail](https://www.nextail.nl/) - * [NPO](https://www.npostart.nl/) - [github](https://github.com/npo-topspin) - * [nx'change](https://www.nxchange.com/) - * [Pocket Media](http://www.pocketmedia.mobi/) - [company website](http://www.pocketmedia.mobi/), [github](github.com/pocketbrain/) - * [Poki](http://poki.com/) - [company website](http://poki.com/company/), [github](https://github.com/pokibv) - * [Pointer Brand Protection](http://pointerbrandprotection.com) - * [Sensys Gatso Group](https://www.sensysgatso.com/) - * [Sentia](https://sentia.com/nl/) - * [The Things Network](http://thethingsnetwork.org/) - [github](https://github.com/TheThingsNetwork/) - * [Travix International](https://www.travix.com/)- [github](https://github.com/Travix-International) - * [Ultraware](https://www.ultraware.nl) - * [Wercker](http://wercker.com) - [github](https://github.com/wercker) - * [Xebia](https://xebia.com/) - [github](https://github.com/xebia) - * [Yonego](https://www.bambelo.com/) - -## New Zealand - * [9Spokes](https://www.9spokes.com/) - [github](https://github.com/9spokes) - * [Aeroqual](https://www.aeroqual.com/) - [github](https://github.com/aeroqual) - * [Boxer®](https://goboxer.com/) - [github](https://github.com/goboxer) - * [Caruso](https://www.getcaruso.com/) - [jobs](https://getcaruso.notion.site/Careers-at-Caruso-eccde6b7efba4e9db87302e71d2a4c41) - * [Comet Backup](https://cometbackup.com) - [github](https://github.com/CometBackup) - * [DroneDeploy Ground Robotics (previously Rocos)](https://www.rocos.io) - [github](https://github.com/team-rocos) - * [GNS Science](https://www.gns.cri.nz/) / [GeoNet](https://www.geonet.org.nz/) - [github](https://github.com/GeoNet) - * [Hapara](http://hapara.com) - [github](https://github.com/Hapara) - * [IQ Hive](https://test.iqhive.com/) - [github](https://github.com/iqhive) - * [Jasper](https://jasper.io) - [github](http://github.com/JasperLabs) - * [Lightspeed](https://www.lightspeedhq.com/) (formerly known as Vend) - [github](https://github.com/vend) - [jobs](https://www.lightspeedhq.com/careers/openings/?office=new-zealand&department=technology) - * [Modica Group](https://www.modicagroup.com/) - [github](https://github.com/modicagroup) - * [Movio](https://movio.co) - [article](https://movio.co/en/blog/migrate-Scala-to-Go/) [github](https://github.com/movio) - * [OnFinality](https://www.onfinality.io/) - [github](https://github.com/OnFinality-io) - * [Portainer.io](https://www.portainer.io/) - [github](https://github.com/portainer) - * [Spalk](http://spalk.co) - [github](https://github.com/SpalkLtd) - * [Sylo](https://www.sylo.io/) - [github](https://github.com/dn3010) - * [Ticketure](https://www.tixtrack.com/ticketure-timed-entry-ticketing/) - [github](https://github.com/stqry) - * [Weta Digital](http://www.wetafx.co.nz) - [Slides](https://talks.godoc.org/github.com/justinfx/demos/go_at_weta/go_at_weta.slide) - * [Xerra Earth Observation Institute](https://www.xerra.nz/) - [Starboard Maritime Intelligence](https://starboard.nz/) - -## Nigeria - * [Jumia Food](https://food.jumia.com/) - Instant delivery platform. - * [Global Performance Index (GPI)](https://www.my-gpi.com/) - Biggest Software automation company in Nigeria. - -## Norway - * [Aller media](https://www.aller.no/) - * [Amedia](https://www.amedia.no/) - * [Avinor](https://avinor.no/) - * [Bare Bitcoin](https://barebitcoin.no) - * [Bouvet](https://www.bouvet.no/) - * [Bridge Technologies](https://bridgetech.tv/) - * [Bulder Bank](https://www.bulderbank.no/) - * [Capra Consulting](https://www.capraconsulting.no/) - * [Canonical](https://canonical.com/) - * [Celerway](https://www.celerway.com/) - * [Conclude](https://concludeapp.com/) - * [CoopX](https://www.coopx.no/) - * [Cutters](https://www.cutters.no/) - * [CYBR](https://www.cybr.ai/) - * [Disruptive Technologies](https://www.disruptive-technologies.com/) - * [DNB](https://www.dnb.no/en) - * [Firi](https://firi.com) - * [Finn.no](https://www.finn.no) - * [Futurehome](https://futurehome.no) - * [Helse Vest IKT](https://www.helse-vest-ikt.no/) - * [Ilder](https://ilder.no/) - * [ITverket](https://www.itverket.no/) - * [Jottacloud](https://www.jottacloud.com/) - * [Just Technologies](https://www.gojust.com/) - * [Laerdal Medical](https://www.laerdal.com/) - * [Moen Marin](https://www.moenmarin.no/) - * [Neatframe](https://neat.no/) - * [No Isolation](https://www.noisolation.com/) - * [Northern.tech](https://northern.tech/) - * [Norwegian Labour and Welfare Administration (NAV)](https://www.nav.no/) - * [Nurofy](https://nurofy.no/) - * [Oda](https://oda.com/no/) - * [Oslo kommune Oslo Origo](https://labs.oslo.kommune.no/) - * [Owners Room](https://ownersroom.com/) - * [Payr](https://www.payr.no) - * [Pexip](https://www.pexip.com/) - * [Pioner Labs](https://www.pionerlabs.com/) - * [qbee](https://qbee.io) - IoT device management platform - * [reMarkable](https://remarkable.com/) - * [Raa Labs](https://www.raalabs.com/) - * [Rendra](https://streambim.com/) - * [Sanity.io](https://www.sanity.io) - * [Schlumberger](https://www.slb.com/) - * [Searis](https://www.searis.no/) - * [Shortcut](https://shortcut.no/) - * [SpareBank1](https://www.sparebank1.no/) - * [Sportradar](https://www.sportradar.com/) - * [Sysco](https://www.sysco.no/) - * [Tapad](https://www.tapad.com/) - * [Telenor](https://www.telenor.no/privat/) - * [Telia](https://www.telia.no/) - * [Teston](https://teston.io/en/), part of [UserTesting](https://www.usertesting.com/) - * [TIDAL](https://tidal.com/) - * [TV2](https://www.tv2.no/) - * [Unacast](https://www.unacast.com/) - * [Vipps](https://www.vipps.no) - * [Webstep](https://www.webstep.no) - * [Zeipt](https://www.zeipt.com) - * [Zendera](www.zendera.no) - -## Oman - * [Rihal](https://www.rihal.om/) - Designed for Data - -## Pakistan - * [Datum Brain](https://datumbrain.com) - [github](https://github.com/datumbrain) - AI, data science, big data analytics and IoT company - * [TalkShot ](https://talkshot.com) - Social Networking based on Live events - -## Philippines - * [22 Delta Labs](https://www.22delta.com) - [github](https://github.com/22delta) - AI, data science, software and product development company - * [EngageSPARK](https://www.engagespark.com) - -## Poland - * [OLX](https://www.joinolx.com/) - [blog](https://tech.olx.com/) - * [allegro](http://allegro.pl) - [blog](http://allegro.tech) - biggest polish e-commerce platform - * [hostit.pl](https://hostit.pl) - [blog](https://hostit.pl/blog/375,go-gadget-go.html) - * [Brainhub](https://brainhub.eu) - [blog](https://brainhub.eu/golang-software-development.html) - * [Cardinal Cryptography](https://cardinals.cc) - blockchain, DLT, and software development - * [CloudThing](https://www.cloudthing.io) - IoT cloud platform - * [HolidayCheck](https://www.holidaycheck.pl/) - * [Husar Labs](http://www.husarlabs.com) - software development company - * [RnDity](https://rndity.com) - software and hardware development company - * [Grey Wizard](https://greywizard.com) - cybersecurity company - * [podioom](http://podioom.net) - With podioom we create bonds that support those who care and who want to stay in shape! - * [beFOGG](http://befogg.mobi) - platform that will take tourism to the next level - * [Miquido](https://www.miquido.com) - Mobile-first software development company - * [Brainly](https://brainly.co/) - [blog](https://medium.com/engineering-brainly) - * [limango](https://www.limango.pl/) - * [SoftKraft](https://www.softkraft.co/golang-development-company/) - software development company - -## Portugal - * [OLX](https://www.joinolx.com/) - [blog](https://tech.olx.com/) - * [AppGeneration](http://appgeneration.com/) - * [Lmit](http://lmit.pt/) - * [Uniplaces](http://uniplaces.com/) - * [Bright Pixel](https://brpx.com/) - * [Observador](https://observador.pt/) - * [SaltPay](https://www.saltpay.co/) - * [Worten](https://www.worten.pt/) - -## Romania - * [Primal Skill](https://www.primalskill.com) - software development company focusing on web, API development with offices in Romania - * [Trisoft](https://www.wearetrisoft.com) - software development company with offices in San Francisco and Romania - * [JobDone](https://jobdone.net) - Freelancer Marketplace - * [CrowdStrike](https://www.crowdstrike.com/) - software development company with offices in US, UK, Romania and Australia - -## Russia -* [2GIS](http://info.2gis.com/) -* [avito.ru](http://avito.ru/) -* [citilink.ru](https://www.citilink.ru/) -* [Gett](http://gett.com/) -* [ITooLabs](http://itoolabs.com) -* [Izvestia](https://iz.ru) -* [iSpring](https://www.ispringsolutions.com) -* [Mail.ru](https://mail.ru/) -* [mc² software](http://www.mc2soft.ru) -* [OZON.ru](http://ozon.ru/) -* [Positive Technologies](https://ptsecurity.com) -* [PostmanQ](https://github.com/actionpay/postmanq) - High performance Mail Transfer Agent (MTA) -* [ThetaPad](http://thetapad.com/) -* [Tinkoff](https://tinkoff.ru) -* [Tochka](http://tochka.com/) -* [TRY.FIT](http://try.fit/) -* [VK.COM](https://vk.com/about) (Part of our Go services: https://www.youtube.com/watch?v=Llmpfv8PIt4) -* [Quadcode](https://quadcode.com) - -## Saudi Arabia -* [Tamkeen Technologies](http://tamkeentech.sa) - -## Serbia -* [Seven Bridges](https://www.sevenbridges.com/) - [github](https://github.com/sbg) - -## Singapore -* [OKiT247](https://okit247.com) - Frontend analytics and web content delivery. -* [Rate](https://rate.com.sg) -* [Singapore Power](https://www.spgroup.com.sg/) -* [Eatigo](https://www.eatigo.com/) -* [ekeynow](https://www.ekeynow.com) - -## Slovenia - * [Koofr](https://www.koofr.eu) - * [nChain](https://nchain.si/) - * [Niteo](https://www.niteo.co) - * [Outbrain](https://www.outbrain.com) - * [Visionect d.o.o.](https://www.visionect.com) - - -## South Africa - * [Luno](http://www.luno.com) - [github](https://github.com/luno) - * [SaltPay](https://www.saltpay.co/) - * [Span Digital](http://www.spandigital.com) - [github](https://github.com/SPANDigital) - * [Ringier SA](https://www.ringier.com/about-us/south-africa/) - International software development company. - -## Southeast Asia - * [Dwarves Foundation](https://dwarves.foundation) - [github](https://github.com/dwarvesf) - * [engageSPARK](https://www.engagespark.com/) - [HN](https://news.ycombinator.com/item?id=10655752) - * [Grab](http://www.grab.com/) - * [HealthCo](http://healthcobot.com) - * [Pocketmath](http://www.pocketmath.com/) - * [Tokopedia](https://www.tokopedia.com/) - * [TablePlus](https://www.tableplus.io/) - * [Carousell](https://sg.carousell.com/) - -## Spain - * [alea soluciones](https://github.com/aleasoluciones/) - * [Bugfender](https://bugfender.com/) - * [Cabify](https://cabify.com/) - [github](https://github.com/cabify/), [twitter](https://twitter.com/cabifydev) - * [jobandtalent](https://www.jobandtalent.com) - * [Ximdex](http://www.ximdex.com) - * [puzzlopia](http://www.puzzlopia.com) - [github](https://github.com/puzzlopia/puzzle-solvers) - * [binomads](https://binomads.com/) - * [Schibsted](http://www.schibsted.com/) - * [Mediasmart.io](http://mediasmart.io) - [twitter](https://twitter.com/mediasmart_mb) - * [Mavrix](https://mavrix.es) - [github](https://github.com/betit/orion-go-sdk) - * [Typeform](https://www.typeform.com/) - * [source{d}](https://sourced.tech) - * [Nayar Systems](http://www.nayarsystems.com/) - * [Stayforlong](https://www.stayforlong.com/) - * [Hosco](https://www.hosco.com/) - -## Sri Lanka - * [Xiges.io](https://xiges.io/) - Low-code Industrial IoT Platform - * [PickMe](https://pickme.lk/) - Universal Hailing Platform - * [Mybudget](https://www.mybudget.com.au/) - Financial Health Management System - * [Moneta](https://www.moneta.lk/) - Sri Lankans' Best Lifestyle App - * [TryFix](https://github.com/tryfix) - Go Platform Developers - * [Circles.Life](https://www.circles.life/) - Building Telecommunication Provider Platform Running in Singapore - -## Sweden - * [Abios](https://abiosgaming.com/) - The world's most trusted esports API. - * [Booli](https://www.booli.se/) - * [Digital Route](https://www.digitalroute.com) - * [Embark Studios](https://www.embark-studios.com/) - * [Encore](https://encore.dev/) - The Cloud-Native Development Platform for Go. - * [Greta](https://greta.io/) - * [Ingrid](https://www.ingrid.com/) - * [Kiliaro](https://kiliaro.com/) - * [LootLocker](https://lootlocker.com/) - * [Min Doktor](https://mindoktor.se/) - * [Modular Finance](https://career.modularfinance.se/) - * [Northvolt](https://northvolt.com/) - The Future of Energy - * [Qlik](www.qlik.com) - [jobs](https://www.qlik.com/us/company/careers/job-listings?overridedefault=true&department=R%2526D&country=-1) - * [Slagkryssaren](https://slagkryssaren.com/) - * [Studentlitteratur](https://www.studentlitteratur.se) - * [TV4](http://www.tv4.se/) - [blog](http://http.tv4.se/2014/12/04/tv4-tech-peter-hellberg-kristian-saebdal-tv4-vara-topplistor-i-go/) - -## Switzerland - * [Acronis](https://www.acronis.com) - * [AgFlow SA](http://www.agflow.com/) - * [Aleph Zero](https://alephzero.org) - blockchain platform - * [Centralway Numbrs AG](https://www.centralway.com/uk/) - * [HolidayCheck](https://www.holidaycheck.ch/) - * [Magazine zum Globus AG](https://globus.ch) - [github](https://github.com/globusdigital) - * [Perron2 GmbH](http://www.perron2.ch) - * [Proton Technologies AG](https://protonmail.com) - * [RedCarbon SA](https://redcarbon.ai/) - * [Ricardo](https://www.ricardo.ch/) - -## Taiwan - * [QNAP Systems, Inc.](https://www.qnap.com) - * [ProphetStor Data Services, Inc.](http://www.prophetstor.com) - * [Duotify Inc.](https://www.duotify.com) (多奇數位創意有限公司) - -## Thailand - * [3DS Interactive](https://3dsinteractive.com) - * [AIS](http://www.ais.co.th/) - Top 3 of telecommunication company in Thailand. - * [Appsynth Asia](https://appsynth.net/) - * Ascend Wealth - An investment platform. - * [Beebber](https://www.beebber.com/) - * [botio](https://www.botio.io/) - * [Computerlogy](https://computerlogy.com/) - * [Dcenbase](http://decenbase.com) - * [Donuts Bangkok](http://www.donuts-bkk.com/) - * [Drone Academy Thailand](http://www.dronecademy.org) - * [DTAC](http://www.dtac.co.th/) - Top 3 of telecommunication company in Thailand. - * [Fastwork](https://fastwork.co/) - Freelance platform in Thailand and Indonesia. - * [Fillgoods](https://fillgoods.co/) - * [Findx Solution](https://findx.co.th) - * [Finnomena](http://www.finnomena.com) - * [Gurusquare](http://www.gurusquare.com) - * [hytexts](https://www.hytexts.com) - * [IBM Solutions Delivery](https://www.ibm.com/th-en) - * [Imatthio](http://www.imatthio.com) - Cloud Service Platform Development in Thailand. - * [Insightera](https://www.insightera.co.th/) - * [KBTG](http://www.kbtg.tech): KASIKORN Business-Technology Group - A group of tech companies of Kasikorn Bank Group. Top 3 in banking services in Thailand. - * [KTB](https://www.ktb.co.th): Krung Thai Bank - Top 10 in banking services in Thailand. - * [LINE Company (Thailand)](https://linecorp.com/th) - Most popular message platform in Thailand. - * [LINE MAN](https://lineman.line.me/) [Wongnai](https://www.wongnai.com) - * [NEXPIE](https://nexpie.com) - * [Odd-e Thailand](https://www.odd-e.com/th) - * [ODDS](http://fb.me/oddsteam) - A group of people that belive tha software development should be fun. And we belive in continues improvement. - * [Omise](https://www.omise.co) - Payment gateway for Thailand. - * [Onedaycat](http://onedaycat.com) - * [Paiduaykanmai](https://www.facebook.com/paiduay.tech/) - * [Paybox](https://www.paybox.work) - * [Que Q](http://www.queq.me/) - * [Sellsuki](https://www.sellsuki.co.th/) - * [SIX network](https://six.network) - Financial Services - * [SPRINT3r](http://sprint3r.com/) - * [T.N. Incorporation](http://www.tnis.com/index) - Core banking tranformation company. - * [Tencent Thailand](https://developers.tencent.co.th/) - * [THiNKNET](https://www.thinknet.co.th) - * [ThoughtWorks Thailand](https://www.thoughtworks.com/careers/thailand) - * [True E-Logistics](http://www.true-e-logistics.com/) - * [TRUE](http://truemoveh.truecorp.co.th) - Top 3 telecommunication company in Thailand. - * [TrueMoney](https://www.truemoney.com) Number one of financial company without branches based in Thailand. - * [WISESIGHT](https://wisesight.com) - Social media data analysis, Previously [ThothZocial](https://thothzocial.com/) - * [Xcellence Corporation](http://www.xclnc.com) - * [Zanroo](https://www.zanroo.com/) - * [Zarewoft](https://github.com/zarewoft) - -## Turkey - * [Admongrel](http://www.admongrel.com/) - * [Frigbo](https://frigbo.com/) - * [Hepiyo](https://hepiyo.com/) - * [icibot](https://icibot.com/) - * [Insider](http://useinsider.com/) - * [LocRep](http://locrep.com/) - [github](https://github.com/locrep) - DevOps OSS Artifact Manager. [Azure-DevOps](https://dev.azure.com/LocRep/) - CI/CD and Scrum - * [MasomoGaming](https://www.masomo.com/) - [github](https://github.com/masomo) - Online HeadBall2 Game Server by Go - * [Mentornity, Inc.](https://mentornity.com/) - Backend API - * [Mos Teknoloji](https://www.mosteknoloji.com) - * [Imer Profesyonel Yonetim](https://www.imeryonetim.com/) - [github](https://github.com/) - Backend APIs - * [Optimum Yazılım](https://www.optimumyazilim.com) - * [Peak Games](https://www.peakgames.net/) - [github](https://github.com/peakgames) - Processing billions of events per day. - * [put.io](https://www.put.io/) - [github](https://github.com/putdotio) - * [Mersin Teknik Asansor](https://www.mersinteknikasansor.com/) - [github](https://github.com/) - Backend APIs - * [MonoPayments](https://monopayments.com/) - [github](https://github.com/monopayments) - Fintech Platform. - * [Robomotion RPA](https://www.robomotion.io) - [github](https://github.com/robomotionio) - Cloud native RPA platform for Kubernetes - * [Sir Studios](http://sirstudios.com) - * [Trendyol.com](https://www.trendyol.com) - [github](https://github.com/Trendyol) - Backend APIs - * [Armut/HomeRun](https://armut.com/) - [github](https://github.com/armutcom) - Backend APIs - * [BiTaksi](https://www.bitaksi.com) - [github](https://github.com/BiTaksi) -## Ukraine - * [Agilites](https://agilites.com) - * [Aura](https://aura.com) - * [ElifTech](http://www.eliftech.com) - * [iLighten](https://ilighten.com/) - * [QArea](https://qarea.com/) - * [Diligences](https://diligences.com/) - * [ElementalsWeb](https://www.elementalsweb.com/) - * [monobank](https://monobank.ua/) - * [VP Software](https://vp.software/) - [tech blog](https://vp.software/insights) - software development company -## United Arab Emirates - * [Milenow](https://www.milenow.com/) - * [PayTabs](https://paytabs.com/) Payment Gateway - Dubai -## United Kingdom - * [4ARMED](https://www.4armed.com/) - * [Acuris](https://www.acuris.com/) - * [Admongrel](http://www.admongrel.com/) - * [A1comms](https://www.a1comms.com/) - * [Badoo](https://badoo.com) - [github](https://github.com/badoo/thunder) - * [BBC](http://www.bbc.co.uk) - [public source](https://github.com/bbc?utf8=%E2%9C%93&q=&type=&language=go) - * [BBC Worldwide](http://www.bbcworldwide.com/) - [source](http://www.quora.com/Go-programming-language/Is-Google-Go-ready-for-production-use/answer/Kunal-Anand) - * [Bedful Booking System](https://bedful.com) - * [Belua](https://www.belua.com) - * [bet365](https://www.bet365.com) - [github](https://github.com/bet365) - * [Bubble Student](https://www.bubblestudent.co.uk) - * [Bud](https://thisisbud.com/) - * [comnoco](https://comnoco.io) - * [Countingup](https://countingup.com) - [github](https://github.com/countingup) - * [Cytora](https://www.cytora.com) - [github](https://github.com/cytora) - * [Deliveroo](https://www.deliveroo.co.uk) - [github](https://github.com/deliveroo/) - * [DeviseOps](https://deviseops.com/) - * [Form3](https://form3.tech) - [github](https://github.com/form3tech) - * [Fortifi](http://fortifi.uk) - [github](https://github.com/fortifi) - * [Awesome Shit You Can Buy](https://awesomeshityoucanbuy.com/) - * [Freelance Marketplace](https://www.fieldengineer.com/) - * [GOV.UK](http://www.gov.uk) - [slides](https://speakerdeck.com/nickstenning/http-building-a-new-router-for-gov-dot-uk) [github](https://github.com/alphagov/router) [blog](https://gdstechnology.blog.gov.uk/2013/12/05/building-a-new-router-for-gov-uk/) - * [Geckoboard](https://www.geckoboard.com) - * [graze](https://www.graze.com) - [github](https://github.com/graze) - * [HM Treasury, UK.gov](http://hm-treasury.gov.uk/) - [github](https://github.com/guidance-guarantee-programme/) - * [Intern Avenue](https://www.internavenue.com/) - * [iZettle](https://www.izettle.com/gb) - [github](https://github.com/iZettle/) - * [Logit.io](https://logit.io/) - * [Lush Digital](http://careers.lush.com/) - [GitHub](https://github.com/lushdigital/) - * [Micro](https://micro.mu/) - [github](https://github.com/micro) - * [Monzo](https://monzo.com/) - [github](https://github.com/monzo), [blog](https://monzo.com/blog/2016/09/19/building-a-modern-bank-backend/) - * [New Bamboo](http://www.new-bamboo.co.uk) - [blog](http://blog.new-bamboo.co.uk/2013/09/17/micro-network-daemons-in-go) - * [News UK](https://www.news.co.uk) - * [oyato cloud](https://oyatocloud.com) - [github](https://github.com/oyato) - * [Paymentsense](https://www.paymentsense.com) - Data team - * [Printer Central](http://www.printercentral.co.uk/) - * [Pusher](https://pusher.com) - [github](https://github.com/pusher) [blog](https://blog.pusher.com) - * [Ravelin](https://www.ravelin.com/) - * [Reactive Markets](https://reactivemarkets.com) - * [Resource Guru](https://resourceguruapp.com) - [blog](https://blog.resourceguruapp.com) - * [Restorepoint](http://www.restorepoint.com) - * [Ryanair](http://www.ryanair.com) - [source](https://youtu.be/CWCHT3GClMM?t=15m) - * [Sainsbury's](http://www.sainsburys.co.uk) - * [SaltPay](https://www.saltpay.co/) - * [Sky Betting & Gaming](https://www.skybetcareers.com) - * [Skyscanner](https://www.skyscanner.net) - * [Songkick](https://www.songkick.com) - * [StorageOS](http://storageos.com) - * [Synthace](https://synthace.com) - [github](https://github.com/antha-lang) - * [thinkmoney](https://thinkmoney.co.uk) - * [Tyk](https://tyk.io) - [github](https://github.com/TykTechnologies/tyk) - * [Utility Warehouse](https://careers.utilitywarehouse.co.uk/departments/technology) - * [Weaveworks](http://weave.works) - * [XTX Markets](http://www.xtxmarkets.com) - [github](https://github.com/XTXMarkets) - * [YouView TV Ltd](http://www.youview.com) - * [Ernest.io](http://ernest.io) - * [Landoop](https://www.landoop.com/) - [github](https://github.com/landoop), [blog](https://www.landoop.com/blog/) - * [Gram Games](http://gram.gs/) 90% of the backend and internal tools implemented with Go. Using it in production since 2015. - * [WhatsOnChain](https://whatsonchain.com) - Backend APIs for Blockchain Explorer - -## United States - - * [Google](http://google.com/) - the core Go team work at Google. Most uses of Go at Google are confidential. - * [Kubernetes](http://kubernetes.io/) - * The [YouTube](http://youtube.com/) team have released their [MySQL scaling infrastructure](http://vitess.io/) as open source software [1](https://www.youtube.com/watch?v=5yDO-tmIoXY), [2](https://www.youtube.com/watch?v=qATTTSg6zXk), [3](https://www.youtube.com/watch?v=midJ6b1LkA0&sns=gp) - * dl.google.com is written in Go: [mailing list discussion](https://groups.google.com/forum/?fromgroups=#!topic/golang-nuts/BNUNbKSypE0) / [OSCON slides](http://talks.golang.org/2013/oscon-dl.slide#1) - * [Flywheel: Google's Data Compression Proxy for the Mobile Web](http://research.google.com/pubs/pub43447.html), [blog post on the rewrite](http://matt-welsh.blogspot.co.uk/2013/08/rewriting-large-production-system-in-go.html) - * [A lot of scripts that earlier were written in Sawzall](http://www.unofficialgoogledatascience.com/2015/12/replacing-sawzall-case-study-in-domain.html) - * [Seesaw load balancer](http://google-opensource.blogspot.nl/2016/01/seesaw-scalable-and-robust-load.html) -[github repo](https://github.com/google/seesaw) - * Other known uses include - * the [Turkey Doodle (2011)](https://go.dev/blog/2011/12/from-zero-to-go-launching-on-google.html), - * the [Santa Tracker (2012)](https://www.youtube.com/watch?v=fc25ihfXhbg), - * [writing map/reduce jobs](http://simplystatistics.org/2013/02/15/interview-with-nick-chamandy-statistician-at-google/), - * [Jam With Chrome](http://www.jamwithchrome.com/technology), - * the [CubeSlam Chrome Experiment](https://code.google.com/p/cubeslam/), - * Google Helpouts, - * [Doorman, Global Distributed Client Side Rate Limiting](https://github.com/youtube/doorman) - * [pprof command line tool](https://codereview.appspot.com/153750043/) - * [pi.delivery API for Pi Day 2019](https://pi.delivery) - * [6Wunderkinder](http://www.6wunderkinder.com/) - [video](https://www.youtube.com/watch?v=sVpMc0hwqps) - * [99designs](http://www.99designs.com) - [golang-nuts](https://groups.google.com/d/msg/golang-nuts/eeAmkzaRt-w/rmxBZszJUCcJ) - * [Abot](https://www.itsabot.org) - [github](https://github.com/itsabot/abot) - * [ActiveState](http://www.activestate.com) - [github](https://github.com/activestate) - * [Acquia](https://www.acquia.com) - [blog](https://dev.acquia.com/blog/open-sourcing-statsgod-a-statsd-implementation-in-go/16/11/2015/8171) - * [adeven](http://www.adeven.com) - [blog](http://big-elephants.com/2012-10/deploying-go-with-capistrano/) - * [Adobe](https://www.adobe.com/) - * [SEMRush Pricing](https://www.cloudsdeal.com/2020/06/semrush-free-trial.html) - * [Adori Labs](http://www.adorilabs.com/) - * [AeroFS](https://www.aerofs.com/) - [github](https://github.com/aerofs/gockerize), [blog](https://www.aerofs.com/blog/introducing-gockerize/) - * [Aerospike](http://www.aerospike.com) - [blog](https://groups.google.com/d/msg/golang-nuts/GA902tHnjdM/ARRaBS2g4zEJ) - * [Airbrake](http://airbrake.io/) - * [Airware](http://airware.com/) - [eng blog](https://makers.airware.com), [github](https://github.com/airware) - * [Alaska Airlines](https://www.alaskaair.com/) - [github](https://github.com/AlaskaAirlines?utf8=%E2%9C%93&q=&type=&language=go) - * [Amazon Web Services](https://aws.amazon.com) - [github](https://github.com/aws) [github](https://github.com/awslabs) - * [American Express](https://americanexpress.com) - [github](https://github.com/americanexpress) - * [Apcera](http://www.apcera.com) - [blog](http://gigaom.com/2012/09/13/will-go-be-the-new-go-to-programming-language/) - * [Apeiron Data Systems](http://apeirondata.com/) - * [Appbase](https://appbase.io/) - * [Append Media](https://append.media/) - * [Appoxy](http://appoxy.com) - [twitter](https://twitter.com/appoxy) - * [AppsCode Inc.](https://appscode.com) - [github](https://github.com/appscode), [twitter](https://twitter.com/appscodehq) - * [Arista Networks](http://www.arista.com/en/) - [twitter](https://twitter.com/tsunanet/status/665998079724621825) - * [Ardan Studios/Labs](http://www.ardanstudios.com) - [twitter](https://twitter.com/ardanlab) - * [Aruba Networks](http://www.arubanetworks.com/) - [golang-nuts](https://groups.google.com/d/msg/golang-nuts/M2koiSyoF6E/8rUujT5RCwEJ) - * [Ascendant Compliance Manager](https://www.ascendantcompliancemanager.com/) - Batch process millions of security trades per day. - * [Assembled](https://www.assembled.com/) - [github](https://github.com/assembledhq) - * [AT&T](https://www.att.com/) - [Github](https://github.com/att?utf8=%E2%9C%93&q=&type=&language=go) and [gopkgs repository](https://github.com/att/gopkgs) - * [Atatus](http://www.atatus.com/) - [blog](http://www.atatus.com/blog/golang-auto-build-versioning/) - * [Aura](https://aura.com) - * [Avocet](http://avocet.io/) - [blog](http://blog.avocet.io/from-0-to-6-2-billion-requests/) - * [Awake Networks](http://www.awakenetworks.com) - * [Axioms](http://axioms.io) - [blog](http://axioms.io/zen/2014-11-06-swift-go/) - * [Basecamp](https://basecamp.com/) - [blog](https://signalvnoise.com/posts/3897-go-at-basecamp) - * [Batch.sh](https://batch.sh) - [github](https://github.com/batchcorp) - * [Beachfront Media](http://www.beachfrontmedia.com) [article](http://arstechnica.com/information-technology/2013/05/my-favorite-programming-language-googles-go-has-some-coders-raving/) - * [Beam](https://beam.pro) - [github](https://github.com/WatchBeam) - * [Beehively](http://beehively.com) - [Presentation](https://speakerdeck.com/nexneo/joy-of-single-purpose-services-in-go) - * [Betable](https://betable.com) - [talk #1](http://rcrowley.org/talks/surge-2013.html), [talk #2](http://rcrowley.org/talks/strange-loop-2013.html) - * [Benzinga](https://www.benzinga.com) - [pro](https://pro.benzinga.com/), [jobs](http://jobs.benzinga.com/) - * [BigCommerce](https://www.bigcommerce.com/) - [blog](http://www.bigeng.io/what-keeps-us-going/), [github](https://github.com/bigcommerce) - * [Bitbucket](https://bitbucket.org/) - [source](http://www.reddit.com/r/golang/comments/1pjn0k/bitbucket_hiccup_reveals_go_usage/) - * [bitly](http://bit.ly) - [github](https://github.com/bitly/nsq) [blog](http://word.bitly.com/post/33232969144/nsq) - * [Blippar](http://blippar.com) - * [Bluecore](http://bluecore.com) - * [Blink Analytics](https://blinkanalytics.com) - [github](https://github.com/blinkanalytics) - * [Bolt](http://bolt.com) - * [bol.com](http://bol.com) - [github](https://github.com/emicklei/go-restful) [blog](http://ernestmicklei.com/2015/07/04/testing-your-rest-api-in-go-with-forest/) - * [botvs.com](http://botvs.com) - * [Booking.com](http://booking.com) - [source](http://www.techworld.com/careers/perl-developers-dispel-doubts-about-codes-longevity-3599357/) - * [Boot.dev](https://boot.dev) - [source](https://blog.boot.dev/misc/qvault-full-stack-architecture-example/) - * [Bread Finance](https://www.getbread.com) - * [Bridgevine](https://bridgevine.com/) - [github](https://github.com/Bridgevine) - * [Brightcove](https://brightcove.com) - * [Bringhub](https://bringhub.com) - * [BuySellAds](https://buysellads.com) - * [BuzzFeed](https://buzzfeed.com) - [talk](https://go-talks.appspot.com/github.com/jonmorehouse/gateway-golang-talk/main.slide#1) - * [Byndr](http://www.byndr.org) - * [ByteGain](https://bytegain.com/) - * [Canonical](http://canonical.com/) - [source](http://www.youtube.com/watch?v=7QDVRowyUQA), [email](https://groups.google.com/d/msg/golang-nuts/jLnMsUbYwrQ/isfMUvBOkEIJ) - * [CBS Interactive](http://www.cbsinteractive.com) - [github](https://github.com/cbsinteractive?language=go) - * [Capital One](https://www.capitalone.com) - [blog](https://medium.com/capital-one-tech/tagged/golang) - * [Caprinova](http://caprinova.com) - * [Carmatec](https://www.carmatec.com) - * [Carbon Games](http://carbongames.com/) - [source](http://carbongames.com/opensource.html#the_go_programming_language_bsd) - * [CB Insights](https://www.cbinsights.com/) - [source](https://www.cbinsights.com/research/team-blog/why-we-chose-golang/) - * [CenturyLink](https://www.ctl.io/) - [github](https://github.com/CenturyLinkCloud?language=go) - * [Channel](https://www.getchannel.co) - * [Chatlio](https://chatlio.com) - * [Chubbs Solutions](https://chubbs.solutions) - Progressive Tech (APIs). - * [Cisco](https://cisco.com/) - [github](https://github.com/cisco?utf8=%E2%9C%93&q=&type=&language=go) - * [CircleCI](https://circleci.com) - * [Circonus](https://www.circonus.com) - * [Clearblade](http://clearblade.com/) - [github](https://github.com/ClearBlade/Go-SDK) - * [Clever](https://clever.com/) - [github](https://github.com/clever) [blog](http://engineering.clever.com/) - * [ClickAway](https://clickaway.com/) - * [CloudFlare](http://www.cloudflare.com/) - [blog](http://blog.cloudflare.com/go-at-cloudflare) [article](http://arstechnica.com/information-technology/2013/02/cloudflare-blows-hole-in-laws-of-web-physics-with-go-and-railgun/) - * [Cloud Foundry](http://www.cloudfoundry.com) - [blog](http://pivotallabs.com/a-rubyist-learning-go-a-basic-go-program/) [github](https://github.com/cloudfoundry) - * [CloudWalk](https://www.cloudwalk.io) - [github](https://github.com/cloudwalkio/) - * [clypd](http://www.clypd.com) - [blog](http://www.clypd.com/getting-to-go/) - * [Cockroach Labs](http://www.cockroachlabs.com/) - [blog](http://www.cockroachlabs.com/blog/why-go-was-the-right-choice-for-cockroachdb/) [github](https://github.com/cockroachdb/) - * [CodeShip](https://codeship.com) - [blog](https://blog.codeship.com/creating-fakes-in-go-with-channels/) - * [Comcast](http://corporate.comcast.com/) - [github](https://github.com/comcast) - * [Conformal Systems](http://www.conformal.com) - [github](https://github.com/conformal) - * [Copper.IO](http://copper.io) - [blog](https://blog.copper.io/building-a-scaleable-app-that-can-actually-scale/) - * [CoreOS](https://coreos.com/) - [github](https://github.com/coreos/), [blog](http://blog.gopheracademy.com/birthday-bash-2014/go-at-coreos/) - * [Couchbase](http://www.couchbase.com/) - [github](https://github.com/couchbaselabs) - * [Crashlytics](http://try.crashlytics.com/) - [tweet](https://twitter.com/brianhatfield/status/360866306276327424) - * [Crowdstrike](http://www.crowdstrike.com/) - [blog](http://jimplush.com/talk/2015/12/19/moving-a-team-from-scala-to-golang/) - * [Cupcake](https://cupcake.io) - [tweet](https://jonathan.cupcake.is/posts/QweOXcW6rmbdj16aXlEdNA) [github](https://github.com/cupcake) - * [CURT Manufacturing](https://www.curtmfg.com) - [github](https://github.com/curt-labs/) - * [Cycle.io](https://cycle.io) - * [CustomerIO](http://www.customer.io) - [tweet](https://twitter.com/jrallison/status/365560974251540481) - * [Dailymotion](http://www.dailymotion.com) - [github](https://github.com/dailymotion), [blog](http://engineering.dailymotion.com/our-way-to-go/) - * [Datadog](https://www.datadoghq.com) - [blog](http://blog.gopheracademy.com/birthday-bash-2014/go-at-datadog/) - * [Datascale](http://datascale.io) - * [DeferPanic](https://deferpanic.com) - [github](https://github.com/deferpanic) - * [Dell](https://www.dell.com) - * [Diggernaut](https://www.diggernaut.com) - Data mining and extraction service - * [DigitalOcean](http://www.digitalocean.com/) - [blog](http://www.digitalocean.com/company/blog/get-your-development-team-started-with-go/) - * [Discovery](https://discovery.com) - Video streaming. - * [Disney](https://disney.com) - [Gophercon 2017 lightning talk](https://www.youtube.com/watch?v=OMhXJD54ZDM) - * [Disqus](http://disqus.com/) - [blog](http://blog.disqus.com/post/51155103801/trying-out-this-go-thing), [blog](http://highscalability.com/blog/2014/5/7/update-on-disqus-its-still-about-realtime-but-go-demolishes.html) - * [DNSimple](https://dnsimple.com/) - [blog](http://blog.dnsimple.com/a-golang-redirection-service/) - * [Docker](https://www.docker.com/) - [docker](https://github.com/docker/docker) [slides] - * [domainr](http://domai.nr/) - [tweet](https://twitter.com/rr/status/368988340848037889) - * [Dollar Shave Club](https://www.dollarshaveclub.com) - [blog](http://engineering.dollarshaveclub.com/) - * [DoltHub](https://www.dolthub.com/) - [Dolt](https://github.com/dolthub/dolt): The first and only SQL database that supports clone, branch, and merge. [(GitHub)](https://github.com/dolthub/dolt) [(Twitter)](https://twitter.com/dolthub) [(Discord)](https://discord.com/invite/RFwfYpu) - * [DotDashPay](https://www.dotdashpay.com) - [github](https://github.com/dotdashpay) - * [DoubleDutch](https://www.doubledutch.me) -(http://www.slideshare.net/jpetazzo/docker-and-go-why-did-we-decide-to-write-docker-in-go) - * [Doximity](https://www.doximity.com) - * [DramaFever](https://www.dramafever.com/) - [github](https://github.com/DramaFever) - * [DreamList](https://www.dreamlist.com/) - * [drone.io](http://drone.io) - [post](https://groups.google.com/d/msg/golang-nuts/Lo7KP3rWP3o/GvNju75FgPIJ) [github](https://github.com/drone) - * [Dropbox](http://www.dropbox.com) - [blog](https://tech.dropbox.com/2014/07/open-sourcing-our-go-libraries/), [github](https://github.com/dropbox/godropbox) - * [Druva](https://www.druva.com) - The data resiliency cloud - * [eBay](http://www.ebay.com/) - [github](https://github.com/eBay/fabio), [meetup](http://www.meetup.com/golang-amsterdam/events/222001978/) - * [Economist](http://www.economist.com/) - [github](https://github.com/EconomistDigitalSolutions/ramlapi) - * [Embedly](http://embed.ly) - [blog](http://blog.embed.ly/post/45149878472/167857590) - * [EMC Cloud Services](http://www.emc.com/campaign/emc-cloud-services/index.htm) - [tweet](https://twitter.com/chadlung/status/622118049500364800) - * [Enova](https://www.enova.com) - [github](https://github.com/enova?language=go), [blog](https://innovation.enova.com/tag/go/) - * [ERNIT](http://www.ernit.com) - [Medium](https://medium.com/@amandeep.midha/case-for-kubernetes-go-google-appengine-gae-rabbitmq-and-hitting-the-glass-ceiling-51d6a60d307d) - * [EverQuote](https://www.everquote.com) - * [Everything.me](http://everything.me) - [blog](http://geeks.everything.me/2015/05/03/adventures-with-disque/) - * [Expedia](https://www.expediagroup.com/) - [github](https://github.com/ExpediaDotCom?language=go) - * [Facebook](https://facebook.com) - [github](https://github.com/facebookgo/), [blog](http://blog.parse.com/learn/how-we-moved-our-api-from-ruby-to-go-and-saved-our-sanity/) - * [FieldEngineer](https://www.fieldengineer.com/) - * [Factom](http://www.factom.org) - [github](https://github.com/FactomProject) - * [Fanatics](https://www.fanatics.com) - [github](https://github.com/Fanatics) - * [Fast](http://fast.co) - [github](https://github.com/fast-af), [twitter](https://twitter.com/fastdotco) - * [ForexSignals](https://www.fxprofitpips.com/) - * [Fastly](http://www.fastly.com) - [blog](https://www.fastly.com/blog), [twitter](https://twitter.com/fastly) - The only real-time content delivery network designed to seamlessly integrate with your development stack. - * [Foize](https://www.foize.com) - [github](https://github.com/foize/) - * [Flipboard](http://www.flipboard.com) - [source (job post)](https://news.ycombinator.com/item?id=6140956) - * [FLXOne](http://flxone.com) - [blog](https://medium.com/@robin.verlangen/billions-of-request-per-day-meet-go-1-5-362bfefa0911) - * [Fullstory](https://www.fullstory.com/) - [blog](http://blog.gopheracademy.com/birthday-bash-2014/go-at-fullstory/) - * [FuboTV](https://www.fubo.tv/) - * [Gaikai (Playstation NOW)](https://gaikai.com/) - * [Gatherer](http://gathererapp.com/) - [twitter](https://twitter.com/codepushr/status/653880049343537153) - * [Gamegos](https://github.com/gamegos) - * [Gametime](https://gametime.co/) - * [Gemfury](https://gemfury.com) - * [General Electric Software](https://www.gesoftware.com/) - [tweet](https://twitter.com/cemezberci/status/623179382505390080), [jobs](https://xjobs.brassring.com/tgwebhost/jobdetails.aspx?partnerid=54&siteid=5346&jobid=1254417) - * [Gengo](http://www.gengo.com) - [blog](http://blog.gengo.com/go-gengo/) - * [Getty Images](http://www.gettyimages.com) - [tweet](https://twitter.com/TrevorBramble/status/441372661336113152) [tweet](https://twitter.com/ickypop/status/441470245492908032) - * [GitHub](https://github.com) - [blog post](http://techno-weenie.net/2013/11/2/key-value-logs-in-go/) - * [GitLab](https://about.gitlab.com/) - [gitaly](https://gitlab.com/gitlab-org/gitaly/) - * [GlobalSign](https://www.globalsign.com) - * [Granify](http://granify.com/) - [blog](http://leonsbox.com/blog/2013/06/04/improving-testing-by-using-real-traffic-from-production/) - * [GrayMeta, Inc.](https://www.graymeta.com) - * [Grovo](https://grovo.com) - * [Glympse](https://www.glympse.com) - * [Hailo](http://www.hailocab.com) - [slides](https://speakerdeck.com/mattheath/youre-good-to-go) - * [Happy Pancake](http://www.happypancake.com/) - [blog](https://abdullin.com/happypancake/) - * [HashiCorp](https://hashicorp.com/) - [github](https://github.com/hashicorp) - * [HER](https://weareher.com/) - * [Heroku](http://heroku.com/) - [Go blog post](https://go.dev/blog/2011/04/go-at-heroku.html), [news](http://www.theregister.co.uk/2011/05/05/google_go/) - * [Hewlett Packard Enterprise](https://hpe.com) - [Github](https://github.com/HewlettPackard) - * [Home24](http://www.home24.de) - [github](https://github.com/home24) - * [Honeywell](https://www.honeywell.com) - * [Hooklift](https://github.com/hooklift) - [github](https://github.com/hooklift) - * [HP](https://hp.com) - * [HyperDev](https://hyperdev.com/) - [blog post](http://stackshare.io/hyperdev/the-hyperdev-tech-stack-powering-over-1m-containers) - * [IBM](http://www.ibm.com/) - [Clampify](https://developer.ibm.com/open/clampify/), [i18n4go](https://developer.ibm.com/open/i18n4go/), [IBM zOS](https://www.ibm.com/products/open-enterprise-sdk-go-zos/details), [libsecurity](https://developer.ibm.com/open/libsecurity/) - * [Igneous](http://www.igneous.io/) - * [Imagefly](http://imagefly.io/) - * [Imgix](https://www.imgix.com) - [StackShare](http://stackshare.io/imgix/how-imgix-built-a-stack-to-serve-100-000-images-per-second), [job posting](https://www.imgix.com/jobs#752d046c-c795-47ea-9f90-117d761a557e) - * [Imgur](http://imgur.com/) - [github](https://github.com/Imgur/mandible/) - * [INdigital](https://indigital.net) - APIs and Microservices for Public Safety. - * [InfluxData](https://influxdata.com/) - [blog](http://blog.gopheracademy.com/birthday-bash-2014/why-influxdb-uses-go/) [github](https://github.com/influxdata) - * [Instela](https://tr.instela.com) - * [Intel](http://www.intel.com) - [snap telemetry framework](https://github.com/intelsdi-x/snap), [ciao cloud orchestration](https://github.com/01org/ciao), [Clear Containers](https://github.com/clearcontainers) - * [identakid.com](http://identakid.com) - * [Invoiced](https://invoiced.com) - * [Ionic Security](https://www.ionic.com/about/careers) - * [IPinfo.io](https://ipinfo.io/) - * [Iron.io](http://iron.io/) - [source](http://www.youtube.com/watch?v=kKQLhGZVN4A) [blog:"30 servers to 2"](http://blog.iron.io/2013/03/how-we-went-from-30-servers-to-2-go.html) [blog:"2 years of production Go"](http://blog.iron.io/2013/08/go-after-2-years-in-production.html) - * [ISDC - InsideSales.com](http://insidesales.com) - * [iTechArt](https://www.itechart.com/) - * [Jack Henry and Associates](https://www.jackhenry.com/pages/default.aspx) - * [JelloLabs](http://www.jellolabs.com) - * [Jenkins X](https://jenkins-x.io) - [GitHub](https://github.com/jenkins-x) - * [Jimdo](http://www.jimdo.com) - [tweet](https://twitter.com/mlafeldt/status/351661314017476608) [github](https://github.com/jimdo) - * [Jive](https://jive.com) - [github](https://github.com/jive) - * [Jive Software](http://www.jivesoftware.com) - [github](https://github.com/jivesoftware) - * [JPMorgan Chase](https://www.jpmorganchase.com) - [github](https://github.com/jpmorganchase) - * [Karma](http://www.yourkarma.com) - [blog](https://blog.yourkarma.com/how-we-use-mqtt-at-karma) - * [Kayako](http://www.kayako.com/) - [twitter](https://twitter.com/freatbeater/status/654689942254161920) - * [Keybase.io](http://keybase.io) - [github](https://github.com/keybase) - * [Khan Academy](https://www.khanacademy.org) - [blog](https://blog.khanacademy.org/half-a-million-lines-of-go/) - * [Kohl's](https://www.kohls.com) - [github](https://github.com/KohlsTechnology?utf8=%E2%9C%93&q=&type=&language=go) - * [Kingsoft](http://www.kingsoft.com/) - [github](https://github.com/flike/kingshard) - * [Chamoji](http://chamoji.com/) - [augmented reality](https://chamoji.com/game-chamoji) - * [K&J Translations](https://kjtranslations.com/) - * [Kochava](https://www.kochava.com/) - * [Koding](http://www.koding.com) - [quora](http://www.quora.com/Node-js/Why-did-Koding-switch-from-Node-js-to-Go) - * [LabStack](http://labstack.com/) - [github](https://github.com/labstack/echo), [website](http://echo.labstack.com/) - * [Laserlike](https://www.laserlike.com/) - * [LaunchDarkly](https://launchdarkly.com/) - [github](https://github.com/launchdarkly/), [golang sdk](https://github.com/launchdarkly/go-server-sdk) - * [Lean Labs](http://kanban.leanlabs.io/) - [git release](https://gitlab.com/leanlabsio/kanban/blob/master/CHANGELOG.md#130-2015-09-06) - * [Liftoff](https://liftoff.io/company/engineering/) - * [Lincoln Loop](http://lincolnloop.com/) - [blog (as part of https://botbot.me/ , #go-nuts IRC logging)](http://lincolnloop.com/blog/djangonaut-building-webapp-go-gorilla/) - * [Linc Global](https://www.letslinc.com/) - * [LiveRamp](https://liveramp.com/) - * [Lob](https://www.lob.com) - * [LocalRaces](https://localraces.com/) - [website](https://localraces.com/about) - * [LogPacker](https://logpacker.com/) - [website](https://logpacker.com) - * [LosVirtuality](https://www.losvirtuality.com/) - [website](https://www.losvirtuality.com/) - * [Lovoo](https://lovoo.com/) - [github](https://github.com/lovoo) - * [Luckie & Company](http://luckie.com) - * [Luxor](https://mining.luxor.tech/) - * [Lyft](http://lyft.com) - [github](https://github.com/lyft) - * [Lytics](https://www.lytics.com/) - CDP that automates 1:1 marketing - * [Magento](http://magento.com) - * [Magic Leap](http://www.magicleap.com) - [twitter](https://twitter.com/MrGossett/status/724926614065270786) - * [Maldive](https://www.maldive.com) - * [MalwareBytes](https://www.malwarebytes.org/) - [blog](http://marcio.io/2015/07/handling-1-million-requests-per-minute-with-golang/) - * [Mastercard](https://mastercard.com) - [github](https://github.com/Mastercard?utf8=%E2%9C%93&q=&type=&language=go) - * [Mattel](http://play.mattel.com/) - Mattel uses go on its backend for APIs and IOT data processing. - * [Mattermost](https://about.mattermost.com/) - [github](https://github.com/mattermost) - Open source, private cloud Slack-alternative - * [MaxCDN](http://www.maxcdn.com) - [blog](http://blog.maxcdn.com/learned-stop-worrying-love-logs/) - * [Medium](https://medium.com) - [blog](https://medium.com/medium-eng/how-medium-goes-social-b7dbefa6d413) - * [MediaMath](https://mediamath.com) - [github](https://github.com/MediaMath/grim), [youtube](https://youtu.be/eDRoaxXerOM) - * [Mesosphere](https://mesosphere.com) - [github](https://github.com/mesosphere) - * [Meta Search](https://www.meta.sc/) - [twitter](https://twitter.com/AndyHaskell2013/status/651528742330855424) - * [Microcosm](http://www.microco.sm) - [slides](https://speakerdeck.com/mattcottingham/building-an-api-with-go-at-microco-dot-sm) - * [Mindbowser](http://mindbowser.com/) - * [Minio](https://minio.io/) - [github](https://github.com/minio/minio) [blog](https://github.com/minio/minio)- Object Storage compatible with Amazon S3 API - * [Modcloth](http://www.modcloth.com) - [github](https://github.com/modcloth-labs) - * [Moovweb](http://www.moovweb.com) - [github](https://github.com/moovweb) [source](https://groups.google.com/forum/#!topic/golang-nuts/MeiTNnGhLg8/discussion) - * [MongoDB](http://www.mongodb.com) - [github](https://github.com/orgs/mongodb/repositories?q=&type=all&language=go&sort=stargazers), [blog](http://blog.mongodb.org/post/51643994762/go-agent-go) - * [Monsoon Commerce](https://www.monsooncommerce.com/) - [blog](https://www.monsooncommerce.com/2015/10/open-source-go-uptime/) - * [Mozilla](https://go.mozilla.org) - [github](https://github.com/search?o=desc&q=org%3Amozilla+org%3Amozilla-services+org%3Amozilla-it+language%3AGo&ref=searchresults&s=stars&type=Repositories&utf8=%E2%9C%93) - * [MROffice](http://mroffice.org/) - [source](http://www.youtube.com/watch?v=7QDVRowyUQA) - * [Namely](http://www.namely.com/) - [blog](https://medium.com/namely-labs/postgres-in-go-cf794adc4c52) - * [NetApp](https://netapp.io/) - [github](https://github.com/NetApp?utf8=%E2%9C%93&q=&type=&language=go) - * [Netflix](http://www.netflix.com) - [github](https://github.com/Netflix/rend), [blog](http://techblog.netflix.com/2016/05/application-data-caching-using-ssds.html) - * [New Relic](http://newrelic.com/) - [HN](https://news.ycombinator.com/item?id=10661031) - * [New York Times](http://nyt.com/) - [source](http://open.blogs.nytimes.com/2014/07/10/emr-streaming-in-go/?_php=true&_type=blogs&_r=0) - * [News Corp](https://newscorp.com/) - * [Newspaper](http://www.newspaper.io/) - [source](https://angel.co/newspaperio) - * [Nextdoor](http://www.nextdoor.com) - [source](https://engblog.nextdoor.com/what-is-the-technology-behind-nextdoor-5b74b3efcc31) - * [Next Jump](https://www.nextjump.com) - Next Jump the company that manages the perks platform [Perks at Work](https://www.perksatwork.com) uses Go in it's backend. - * [NextUser](https://www.nextuser.com) - * [Nexway](http://www.nexway.com) - * [Nike](http://engineering.nike.com/) - [github](https://github.com/Nike-Inc?utf8=%E2%9C%93&q=&type=&language=go) - * [Ninchat](https://ninchat.com/) - [twitter](https://twitter.com/timosavola/status/555993344766390272) - * [Nordstrom](https://nordstrom.com) - [github](https://github.com/Nordstrom?utf8=%E2%9C%93&q=&type=&language=go) - * [Northwestern Mutual](https://www.northwesternmutual.com/) - [github](https://github.com/northwesternmutual?q=&type=&language=go) - * [Novartis](http://www.novartis.com) - [g+ post](https://plus.google.com/114945221884326152379/posts/d1SVaqkRyTL) - * [Nutanix](http://www.nutanix.com) - * [Odoscope](http://www.odoscope.com) - [twitter](https://twitter.com/odoscope/status/642383738249322496), [job](http://www.odoscope.com/career-at-odoscope/developer-vacancy/) - * [Ookma-Kyi](https://www.ookma-kyi.tech) - Open Source Implementation of the now defunct Battlemail MMO -[Github](https://www.github.com/ookma-kyi/) [Twitter](https://mobile.twitter.com/Ookma_Kyi/) - * [Ooyala](http://www.ooyala.com/) - [github](https://github.com/ooyala/) - * [Opendoor](https://www.opendoor.com/) - [HN](https://news.ycombinator.com/item?id=10657348) - * [OpenShift](https://www.openshift.com/) - [blog](http://blog.gopheracademy.com/birthday-bash-2014/openshift-3-old-dogs-new-tricks/) - * [Oracle](https://www.oracle.com/us/assets/wercker-faq-3680198.pdf) - Wercker is a Automation platform for Kubernetes & Microservice Deployments - * [Orijtech](https://orijtech.com/) - [github](https://github.com/orijtech/) - * [Ottemo](https://ottemo.io) - Managed Commerce Platform written in golang - * [Outdoorsy](https://www.outdoorsy.co) - * [Outreach](https://www.outreach.io) - * [OvrClk](https://www.ovrclk.com/) - [github](https://github.com/ovrclk) - * [Oyster Books](https://www.oysterbooks.com/) - [blog](http://engineering.oysterbooks.com/post/79458380259/resizing-images-on-the-fly-with-go) - * [Pachyderm.io](http://www.pachyderm.io/) - [github](https://github.com/pachyderm/pachyderm) - * [Packet](https://www.packet.net/) - [github](https://github.com/packethost) - * [Pagoda Box/Nanopack](https://pagodabox.io/) - [github](https://github.com/nanopack/yoke) - * [Pantheon](https://pantheon.io/) - [blog](https://pantheon.io/blog/improving-performance-and-reliability-edge-golang-overhaul) - * [Parse.com](http://www.parse.com/) - [blog](http://blog.parse.com/learn/how-we-moved-our-api-from-ruby-to-go-and-saved-our-sanity/) - * [Partner Fusion](http://www.partnerfusion.com) - * [PayPal.com](https://www.paypal.com) - [github](https://github.com/paypal) - * [Pendo.io](https://www.pendo.io) - [github](https://github.com/pendo-io) - * [Percona](http://www.percona.com) - [blog](https://www.percona.com/blog/tag/go/) - * [pet.io](http://pet.io) - * [Pilosa](https://www.pilosa.com/) - [github](https://github.com/pilosa) - * [Pinshape](https://pinshape.com/) - [job](https://twitter.com/MusicHackFest/status/639219466262454272) - * [Pinterest](https://www.pinterest.com/) - [github](https://github.com/pinterest) - * [Pivotal](https://pivotal.io/) - [Cloud Foundry](https://github.com/cloudfoundry) and [Cloud Foundry Incubator](https://github.com/cloudfoundry-incubator) - * [PocketList](http://pocketlist.co) - * [Points.com](https://points.com/) - Points Loyalty Wallet - * [pool.ntp.org](http://pool.ntp.org/) - [blog](http://news.ntppool.org/2012/10/new-dns-server.html) [status](http://dns-status.ntppool.org/) - * [Poptip](https://poptip.com/) - [blog](http://thenewstack.io/from-node-js-to-go-why-one-startup-made-the-switch/), [job posting](https://groups.google.com/d/msg/golang-nuts/cQ0uuLCcQQQ/4nNm_YYh_l4J) - * [Pressly](https://www.pressly.com) - [github](https://github.com/pressly), [product](https://www.pressly.com) - * [Procore](https://www.procore.com/) - [github](https://github.com/procore/pgnetdetective) - * [Pronovix](http://pronovix.com) - [blog](http://pronovix.com/blog/walkhub-walkthrough-microservice-written-go-no-longer-drupal-distribution), [github](https://github.com/Pronovix), [product](http://pronovix.com/walkhub) - * [Public Good Corp](https://publicgood.com/) - [meetup](http://www.meetup.com/ChicaGoLang/events/222224696/) - * [PullRequest](https://www.pullrequest.com) - [meetup](https://www.pullrequest.com/blog/austin-golang-user-group-recap/) - * Quoori - [github](https://github.com/quoori) - * [Rackspace](http://www.rackspace.com) - [github](https://github.com/rackspace/rack) - * [RailsCarma](https://www.railscarma.com) - * [Raintank](http://www.raintank.io/) - [blog](https://blog.raintank.io/where-and-why-we-use-go/) - * [Rakuten Marketing](http://marketing.rakuten.com) - * [Recime](https://recime.io) - * [RapidLoop](https://www.rapidloop.com/) - [product](https://www.opsdash.com/) - * [Rawstream ](http://www.rawstream.com) - [tweets](https://twitter.com/brianazzopardi/status/387920069327872000) - * [Raygun](http://raygun.io) - [blog](http://raygun.io/blog/2013/11/5-reasons-go-will-kick-ass-in-your-next-project/) - * [RealBuildPro](https://realbuildpro.com/) - [product](https://realbuildpro.com/) - * [Reddit](https://reddit.com) - [AMA post](https://www.reddit.com/r/sysadmin/comments/3h0o7u/were_reddits_ops_team_aua/cu3f88n/), [github](https://github.com/reddit/baseplate.go) - * [Red Ventures](https://www.redventures.com) - * [ReelDx](https://reeldx.com/) - [medvid.io](https://medvid.io), [twitter](https://twitter.com/andrewreeldx) - * [Remember The Milk](https://www.rememberthemilk.com/) - * [Remind101](https://www.remind.com/) - [github](https://github.com/remind101/empire), [blog](http://engineering.remind.com/introducing-empire/) - * [Remitly](https://www.remitly.com) - * [Rendered :Text](http://renderedtext.com/) - [blog](http://renderedtext.com/blog/2013/08/28/building-our-first-app-in-go/) - * [Replicated](https://www.replicated.com) - * [Repustate](http://www.repustate.com) - * [ReverbNation](https://www.reverbnation.com) - * [ReviewTrackers](http://www.reviewtrackers.com/) - [HN](https://news.ycombinator.com/item?id=10660780) - * [Revolving Cow](https://revolvingcow.com) - * [Riot Games](http://www.riotgames.com/) - [talk](https://www.youtube.com/watch?v=2s5l9ErNL3s) - * [Room for More](https://roomformore.com) - * [Rounds](http://www.rounds.com) - [blog](http://www.rounds.com/blog/joys-affordable-concurrency/) - * [RueBaRue](http://www.ruebarue.com) - * [Runscope](http://www.runscope.com) - [blog](http://blog.runscope.com/posts/go-at-runscope) - * [Sagan Systems](http://sagansystems.com/) - [HN](https://news.ycombinator.com/item?id=10659830) - * [Samsara](https://www.samsara.com/) - [blog](https://medium.com/samsara-engineering) - * [Secret](https://www.secret.ly/) - [blog](https://medium.com/secret-den/12ab82fda29f) - * [SecurityScorecard](https://securityscorecard.com/) - [github](https://github.com/securityscorecard) [blog](http://blog.securityscorecard.com) - * [Segment](https://segment.com/) - [github](https://github.com/segmentio?query=go) - * [SendGrid](http://sendgrid.com/) - [blog](http://sendgrid.com/blog/convince-company-go-golang/) - * [SendHub](https://www.sendhub.com/) - [source (shipbuilder PaaS)](http://shipbuilder.io/) - * [SessionM](https://www.sessionm.com) - [HN](https://news.ycombinator.com/item?id=10659861) - * [Shopify](http://www.shopify.com) [tweet](https://twitter.com/burkelibbey/status/312328030670450688) - * [Showyou](http://www.showyou.com) [source](https://plus.google.com/101522949595361604155/posts/8n4CSePMwgV) - * [Shutterfly](http://www.shutterfly.com) - * [SignalFx](https://signalfx.com/) - [blog](http://blog.signalfx.com/why-the-signalfx-metric-proxy-is-written-in-go) - * [Slack](https://slack.com) - [blog](https://slack.engineering/scaling-slacks-job-queue-687222e9d100) - * [SlingTV](https://www.sling.com) - * [SmartyStreets](http://smartystreets.com) - [github](https://github.com/smartystreets), [blog](https://smartystreets.com/blog) - * [SmugMug](http://www.smugmug.com/) - [blog](http://sorcery.smugmug.com/2012/04/06/deriving-json-types-in-go/) - * [Skimlinks](http://www.skimlinks.com) [blog](https://speakerdeck.com/rjohnsondev/go-at-skimlinks) - * [Social Blade](https://socialblade.com) - * [Sorint.US](https://www.sorintlab.com) - [github](https://github.com/sorintlab) - * [SoundCloud](http://soundcloud.com) - [blog](http://backstage.soundcloud.com/2012/07/go-at-soundcloud/) - * [SoundHound](http://soundhound.com) - * [Sourcegraph](https://sourcegraph.com) - [talk](http://www.youtube.com/watch?v=-DpKaoPz8l8), [github](https://github.com/sourcegraph) - * [source{d}](https://sourced.tech) - [github](https://github.com/src-d), [twitter](https://twitter.com/sourcedtech), [blog](https://blog.sourced.tech) - * [Space Monkey](http://www.spacemonkey.com) - [blog](https://www.spacemonkey.com/blog/posts/go-space-monkey) - * [SpaceX](http://www.spacex.com/) - [reddit](https://www.reddit.com/r/golang/comments/3pu3nl/spacex_is_using_go_for_its_telemetry_system/) - * [SpeedyTV](https://www.speedytv.com) - * [Sphere Software](https://sphereinc.com) - [github](https://github.com/spheresoftware) - * [Splice](http://splice.com) - [tweet](https://twitter.com/mattetti/status/387935640513683456), [blog](http://blog.gopheracademy.com/birthday-bash-2014/go-shaped-splice-engineering-culture/), [blog](https://blog.splice.com/golang-improved-simplicity-reduced-maintenance/) - * [Springer](http://joinit.springer.com) - [tweet](https://twitter.com/quii/status/575647166091370497) - * [Squadcast](https://www.squadcast.com/) - * [Square](http://www.squareup.com) - [blog](http://corner.squareup.com/2014/05/evaluating-go-frameworks.html) - * [StackEngine](http://www.stackengine.com) - [blog](http://stackengine.com/golang-with-circleci/) - * [Stack Exchange](http://stackexchange.com/) - [blog](http://blog.stackoverflow.com/2014/11/announcing-bosun-our-new-open-source-monitoring-alerting-system/), [github](https://github.com/bosun-monitor/bosun), [website](http://bosun.org/) - * [Staffjoy](https://www.staffjoy.com) - [blog](https://blog.staffjoy.com/staffjoys-v2-architecture-9d2fcb4015fd) - * [StatHat](http://stathat.com/) - [Go blog post](https://go.dev/blog/2011/12/building-stathat-with-go.html) - * [Steals.com](http://steals.com) [blog](http://blog.gopheracademy.com/day-15-shopping-with-go) - * [SteelSeries](http://www.steelseries.com) - [blog](http://techblog.steelseries.com/golisp/index.html) - * [StorReduce](http://storreduce.com) - * [Stream](https://getstream.io) - [github](https://github.com/getstream/) - * [Stripe](https://stripe.com/) - [github](https://github.com/stripe) - * [SumoLogic](https://www.sumologic.com/) - [github](https://github.com/SumoLogic/sumoshell) - * [SuperHuman](http://superhuman.com/) - [HN](https://news.ycombinator.com/item?id=10660225) - * [SyndicatePro](http://syndicatepro.com/) - [source](https://groups.google.com/d/msg/golang-nuts/eeAmkzaRt-w/rHpoRAGeLD8J) - * [Tamber](http://www.tamber.com/) - [blog](http://www.tamber.com/posts/ferret.html) - * [Tapglue](https://www.tapglue.com/) - * [Tapjoy](http://home.tapjoy.com/) - [blog](http://basho.com/posts/technical/built-on-riak-dynamiq-by-tapjoy/), [github](https://github.com/Tapjoy/dynamiq) - * [Target](https://target.com/) - [blog](https://tech.target.com/infrastructure/2018/06/18/Recommending-GoLang-at-Target.html) - * [Teespring](https://teespring.com/) - * [Telit IoT Portal](http://www.telit.com/products-and-services/iot-platforms/iot-portal/) - * [TelTech](http://www.teltech.co/) - [github](https://github.com/teltechsystems/) - * [Tendermint](http://tendermint.com/) - [github](https://github.com/tendermint/tendermint) - * [TF2Stadium](http://tf2stadium.com) - [github](https://github.com/TF2Stadium), [blog](http://blog.tf2stadium.com/how-it-works-basics/) - * [TGen](https://www.tgen.org/) - [github](https://github.com/tgen), [blog](https://www.tgen.org/blog/) - * [The Home Depot](https://homedepot.com) - * [The Plant](http://theplant.jp) - [Qortex](http://qortex.com), [QoR](http://getqor.com) - * [Thisissoon](http://thisissoon.com/) - [github](https://github.com/thisissoon/yam) - * [Thomson Reuters Eikon](https://github.com/ThomsonReutersEikon) - [github](https://github.com/ThomsonReutersEikon) [source](https://groups.google.com/forum/?fromgroups#!topic/golang-nuts/ikt3hcIqicA), [video](https://www.youtube.com/watch?v=mDTg1dLUqBE) - * [thoughtbot](https://thoughtbot.com/services/go) - [blog](https://robots.thoughtbot.com/tags/go) [github](https://github.com/thoughtbot) - * [Thumbtack](http://thumbtack.com) - [Go Hercule blog post](http://www.thumbtack.com/engineering/go-hercule/) - * [TIBCO](http://www.tibco.com) - * [Ticketmaster](https://www.ticketmaster.com/) - [github](https://github.com/ticketmaster?q=&type=&language=go) - * [Timehop](http://timehop.com/) - [blog](https://medium.com/building-timehop/why-timehop-chose-go-to-replace-our-rails-app-2855ea1912d) - * [TinkerCad](http://tinkercad.com/) - * [Toggl](http://www.toggl.com) - [blog](http://blog.toggl.com/2012/09/moving-to-go/) - * [Torbit ](http://www.torbit.com) - [blog](http://torbit.com/blog/2013/02/19/big-data-at-torbit/) - * [Total Care Auto](http://www.totalcareauto.com/) - * [TraiveFinance](https://traivefinance.com/) - * [Transloadit](https://transloadit.com) - [blog](https://transloadit.com/blog/2014/11/releasing-our-new-go-sdk/) - * [Treetop Commons, NobleHour](http://www.treetopcommons.com/#intro) - [tweet](https://twitter.com/aimeelevens/status/664124807286427648) - * [Trippple](http://trippple.co) - * [Trisoft](https://www.wearetrisoft.com) - software development company with offices in San Francisco and Romania - * [Tumblr ](http://www.tumblr.com) - [github](https://github.com/tumblr/gocircuit) [source](https://groups.google.com/forum/?fromgroups=#!topic/golang-nuts/qelU5Lrq-uA) - * [Tune](https://www.tune.com/) - * [TurboBytes](http://turbobytes.com) - [github](https://github.com/turbobytes?utf8=%E2%9C%93&query=+only%3Asources+), [tweet](https://twitter.com/sajal/status/626287855111835648?s=09) - * [Twitch](http://www.twitch.tv/) - [blog](http://blog.twitch.tv/2014/04/technically-speaking-group-chat-and-general-chat-engineering/) - * [Twitter](https://twitter.com) - [blog](https://blog.twitter.com/2015/handling-five-billion-sessions-a-day-in-real-time) - * [TweetQureet](http://qureet.com) - [blog](http://www.qureet.com/blog/golang-technology-stack/) - * [Uber](http://uber.com) - [blog](https://eng.uber.com/go-geofence/) [github](https://github.com/uber?language=go) [tweet](https://twitter.com/conormyhrvold/status/816345560143642624) - * [Ulele](https://en.ulule.com/) - [tweet](https://twitter.com/thoas/status/638355320071409664) - * [Umbel](http://umbel.com) - [tweet](https://twitter.com/findmjob/status/624255179227967488) - * [Underarmour](https://www.underarmour.com/) - [github](https://github.com/underarmour?q=&type=&language=go) - * [Undisclosed.ch](https://undisclosed.ch/) - [github](https://github.com/xoba/goutil) - * [Unfold](https://unfold.com/) - Part of [Squarespace](https://squarespace.com/) runs all backend services using Go - * [Upskill](https://upskill.io) - [github](https://github.com/APXLabs) - * [Verifone](http://www.verifone.com/) - * [Vertamedia](https://vertamedia.com/) - [github](https://github.com/Vertamedia) - * [VerveMobile](http://www.vervemobile.com/) - * [VHSCast](https://vhscast.com/) - * [Vimeo](https://vimeo.com) - [blog](https://medium.com/vimeo-engineering-blog/video-metadata-caching-at-vimeo-a54b25f0b304), [github](https://github.com/vimeo?q=&type=&language=go) - * [VividCortex](https://vividcortex.com/) - [blog](https://vividcortex.com/blog/2014/11/20/in-case-you-missed-it-developing-mysql-apps-with-go/), [github](https://github.com/VividCortex/) - * [VMware](http://www.vmware.com) - [github](https://github.com/vmware/govmomi) - * [VSCO](http://www.vsco.co) - [blog post](http://www.grpc.io/blog/vscogrpc) - * [Vungle](http://www.vungle.com) - [shared libs, OpenRTB, VAST, etc](https://github.com/Vungle/vungo) - * [Walmart Labs](https://www.walmartlabs.com/) - [github](https://github.com/walmartlabs) - * [Wasabi](https://wasabi.com/) - * [Weave](http://www.getweave.com) - * [Weaveworks](http://weave.works) - * [Western Digital](https://www.westerndigital.com/) - [github](https://github.com/westerndigitalcorporation?&type=&language=go) - * [Wercker](http://wercker.com) - [github](https://github.com/wercker) - * [Whim](http://joinwhim.com/) - [meetup](http://www.meetup.com/golangsf/events/223166815/), [tweet](https://twitter.com/_peggyli/status/629176462155755520) - * [Wikia](http://www.wikia.com) - * [Wireless Registry](http://www.wirelessregistry.com) - [github](https://github.com/wirelessregistry) - * [Workiva](https://www.workiva.com/) - [github](https://github.com/workiva/go-datastructures) - * [WP Engine](https://wpegnine.com/) - [github](https://github.com/wpengine) - * [Verizon Media / Yahoo](http://yahoo.com) - [github](https://github.com/search?utf8=%E2%9C%93&q=user%3Ayahoo+language%3Ago) - * [Yandex](http://yandex.ru) - [blog](https://habrahabr.ru/company/yandex/blog/237985) - * [Yik Yak](http://www.yikyakapp.com/) - [tweet](https://twitter.com/ardanlab/status/629002599484813312/photo/1) - * [Zalando](http://tech.zalando.com/) - [github](https://github.com/zalando) - * [Zapier](https://zapier.com) - [github](https://github.com/zapier) - * [Zenoss](http://www.zenoss.com/) - [github](https://github.com/control-center/serviced) - * [Zenreach](https://zenreach.com) - [jobs](https://www.zenreach.com/careers/) - * [ZITEC](http://www.zitec.de) - * [Zumba](https://www.zumba.com) - [github](https://github.com/zumba) - * [Zynga](http://www.zynga.com) - [github](https://github.com/zbase) - * [Tipe](https://tipe.io) - [github](https://github.com/tipeio) - * [4wardtech Inc](http://4ward.tech/) - -## Vietnam - * [BeGroup](https://be.xyz) - * [ChoTot](https://www.chotot.com) - * [Money Forward Vietnam](https://careers.moneyforward.vn/) - * [ViralWorks](https://viralworks.com) - * [WeTrust](https://www.wetrust.io) - * [VinID](https://vinid.net) - -See also [Success Stories](SuccessStories) - -See also [Wikipedia category](https://en.wikipedia.org/wiki/Category:Free_software_programmed_in_Go) and [Wikidata](https://query.wikidata.org/#SELECT%20DISTINCT%20%3Finstance_of%20%3Finstance_ofLabel%20%3Finstance_ofDescription%20%3Fofficial_website%20WHERE%20%7B%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%20%20OPTIONAL%20%7B%20%3Finstance_of%20wdt%3AP856%20%3Fofficial_website%20%7D%0A%20%20%3Finstance_of%20wdt%3AP277%20wd%3AQ37227.%0A%7D) and [Wikidata for free and open-source software only](https://query.wikidata.org/#SELECT%20DISTINCT%20%3Finstance_of%20%3Finstance_ofDescription%20%3Finstance_ofLabel%20%3Fofficial_website%0AWHERE%20%7B%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%20%20%3Finstance_of%20wdt%3AP31%2Fwdt%3AP279%2a%20wd%3AQ341%0A%20%20OPTIONAL%20%7B%20%3Finstance_of%20wdt%3AP856%20%3Fofficial_website%20%7D%0A%20%20%3Finstance_of%20wdt%3AP277%20wd%3AQ37227.%0A%7D) \ No newline at end of file diff --git a/Gomote.md b/Gomote.md index e6d0f5ef..726b9777 100644 --- a/Gomote.md +++ b/Gomote.md @@ -1,230 +1,4 @@ -# Gomote +The Go wiki on GitHub has moved to go.dev (#61940). -The gomote command is a client for the Go builder infrastructure. It's a remote control for remote Go builder machines. +Try or . -## Installation - -``` -$ go install golang.org/x/build/cmd/gomote@latest # Go 1.16 and later -``` - -## Usage - -The most basic usage of the gomote tool involves just a few steps: -1. Create an instance. -1. Push code to the instance. -1. Run commands on the instance. - -Running the `create` command will list available instance types. - -``` -$ gomote create -(list tons of buildlet types) -``` - -Then, an instance can be created by specifying an instance type. The instance's name will be printed to stdout, so the result may be stored in an environment variable. (There may be other logging messages, but they will be on stderr and each line will have a '#' prefix.) - -``` -$ gomote create linux-amd64 -# still creating linux-amd64 (1) after 5s; 0 requests ahead of you -user-linux-amd64-0 -``` - -With that instance's name you can now push (more specifically sync the contents of) a local Go repository to the instance and install a bootstrap toolchain. The repository you sync will appear at the `go` subdirectory of `$WORKDIR` (the default directory of all gomote operations). The bootstrap toolchain will always go into the `go1.4` subdirectory (even if the bootstrap toolchain isn't from version 1.4). - -``` -$ GOROOT=/path/to/local/go/repo gomote push user-linux-amd64-0 -$ gomote ls user-linux-amd64-0 -go -go1.4 -``` - -Note that `push` really is a "sync" operation, so next time you push the gomote tool will only push what has changed (files added, modified, or removed). - -With a toolchain installed, you can now build it by running commands on the instance. The `run` command allows you to specify an executable to run. The executable must be specified relative to `$WORKDIR` (e.g. `go/bin/go`) or via an absolute path (e.g. `/bin/bash`). That executable will then run with its current working directory set to the directory containing the executable. - -``` -$ gomote run user-linux-amd64-0 go/src/make.bash -``` - -To then run the built Go toolchain, use `go/bin/go`. - -``` -$ gomote run user-linux-amd64-0 go/bin/go test -run="TestSomething" -v runtime -``` - -You can additionally specify a working directory and environment variables to `run` that will be applied before the command is executed. - -Note that gomote instances will automatically disappear after 30 minutes of inactivity. Use the `list` command to check how long they have left. - -``` -$ gomote list -user-linux-amd64-0 linux-amd64 host-linux-amd64-bullseye expires in 10m27.339494527s -``` - -The `ping` command can be used to keep an instance alive if no other commands are being run against it. - -For more information on each command run `gomote help `. For more commands, run `gomote help`. - -### Debugging buildlets directly - -The `create` command contacts the build coordinator (farmer.golang.org) and requests that it create the buildlet on your behalf. All subsequent commands (such as `gomote run` or `gomote ls`) then proxy your request via the coordinator. To access a buildlet directly (for example, when working on the buildlet code), you can skip the `gomote create` step and use the special builder name `@ip[:port>`, such as `windows-amd64-2008@10.1.5.3`. - -### Groups - -Instances may be managed in named groups, and commands are broadcast to all instances in the group. - -A group is specified either by the -group global flag or through the `GOMOTE_GROUP` environment variable. The -group flag must always specify a valid group, whereas `GOMOTE_GROUP` may contain an invalid group. Instances may be part of more than one group. - -Groups may be explicitly managed with the "group" subcommand, but there are several short-cuts that make this unnecessary in most cases: - -- The `create` command can create a new group for instances with the `-new-group` flag. -- The `create` command will automatically create the group in `GOMOTE_GROUP` if it does not exist and no other group is explicitly specified. -- The `destroy` command can destroy a group in addition to its instances with the `-destroy-group` flag. - -As a result, the easiest way to use groups is to just set the `GOMOTE_GROUP` environment variable: - -``` -$ export GOMOTE_GROUP=debug -$ gomote create linux-amd64 -$ GOROOT=/path/to/goroot gomote push -$ gomote run go/src/make.bash -``` - -As this example demonstrates, groups are useful even if the group contains only a single instance: it can dramatically shorten most gomote commands. - -## Tips and tricks - -### General - -The `create` command accepts the `-setup` flag which also pushes a `GOROOT` and runs the appropriate equivalent of `make.bash` for the instance. - -Example: -``` -$ GOROOT=/path/to/my/goroot gomote create -setup linux-amd64 -# Creating user-linux-amd64-0... -# Pushing /path/to/my/goroot to user-linux-amd64-0 -# Running make.bash on user-linux-amd64-0... -``` - -The `create` command accepts the `-count` flag for creating several instances at once. - -Example: -``` -$ gomote create -count=3 linux-amd64 -# Creating user-linux-amd64-0... -# Creating user-linux-amd64-1... -# Creating user-linux-amd64-2... -``` - -The `run` command accepts the `-collect` flag for automatically writing the output from the command to a file in the current working directory, as well as a copy of the full file tree from the instance. This command is useful for capturing the output of long-running commands in a set-and-forget manner. - -Example: -``` -$ gomote run -collect user-linux-amd64-0 /bin/bash -c 'echo hi' -# Writing output to user-linux-amd64-0.stdout... -$ cat user-linux-amd64-0.stdout -hi -$ ls user-linux-amd64-0.tar.gz -user-linux-amd64-0.tar.gz -``` - -The `run` command accepts the `-until` flag for continuously executing a command until the output of the command matches some pattern. This is useful for reproducing rare issues, and especially useful when used together with `-collect`. - -Example: -``` -$ gomote run -collect -until 'FAIL' user-linux-amd64-0 go/bin/go test -run 'TestFlaky' -count=1000 runtime -# Writing output to user-linux-amd64-0.stdout... -$ cat user-linux-amd64-0.stdout -... ---- FAIL: TestFlaky --- -... -$ ls user-linux-amd64-0.tar.gz -user-linux-amd64-0.tar.gz -``` - -Note that the `run` command always streams output to a temporary file regardless of any additional flags to avoid losing output due to terminal scrollback. It always prints the location of the file. - -#### Reproducing a rare failure - -Putting together some of the tricks above and making use of groups, it's much easier to hammer on some test to try to reproduce a rare failure. For example: - -``` -$ export GOMOTE_GROUP=debug -$ GOROOT=/path/to/goroot gomote create -setup -count=10 linux-amd64 -$ gomote run -until='unexpected return pc' -collect go/bin/go run -run="TestFlaky" -count=100 runtime -``` - -### Windows - -``` -$ gomote run -path '$PATH,$WORKDIR/go/bin' $MOTE go/src/make.bat -$ gomote run -path '$PATH,$WORKDIR/go/bin' $MOTE go/bin/go.exe test cmd/go -short -``` - -Note: previous versions of the wiki have advised setting GOROOT for gomote 'run' commands (e.g. "-e GOROOT=c:\workdir\go"); this is no longer recommended (causes problems with Go command caching). - -### Subrepos on Windows - -``` -$ tar --exclude .git -C ~/go/src/ -zc golang.org/x/tools | gomote puttar -dir=gopath/src $MOTE - -$ gomote run -e 'GOPATH=c:/workdir/gopath' $MOTE go/bin/go test -run=TestFixImportsVendorPackage golang.org/x/tools/imports -``` - -If ssh'd into the machine, these envvars may be handy: - -``` -$ set GOPATH=c:\workdir\gopath -$ set PATH=%PATH%;c:\workdir\gopath\bin;c:\workdir\go\bin -$ set CGO_ENABLED=0 -``` - -### Subrepos on Unix - -Testing golang.org/x/sys/unix on $MOTE - -``` -$ tar -C $GOPATH/src/ -zc golang.org/x/sys/unix | gomote puttar -dir=gopath/src $MOTE -$ gomote run -e 'GOPATH=/tmp/workdir/gopath' -dir 'gopath/src/golang.org/x/sys/unix' $MOTE go/bin/go test -v golang.org/x/sys/unix -``` - -(The GOPATH part is for GOPATH compatibility mode; the `-dir` is for modules mode, which looks in the working directory and up for `go.mod`) - -### Android - -``` -export MOTE=`gomote create android-arm64-wikofever` -gomote push $MOTE -gomote run $MOTE go/src/make.bash -``` -PATH must contain the exec wrapper, go_android_*_exec, built by make.bash. - -``` -gomote run -path '$PATH,$WORKDIR/go/bin' $MOTE go/bin/go test math/big -``` - -## About buildlets - -https://farmer.golang.org/builders lists information about how each buildlet is deployed and configured. -The information is from golang.org/x/build/dashboard and golang.org/x/build/env. - -## Access - -**On August 2022, a new infrastructure was deployed which required the removal of all gomote access from previously approved users. Please re-request access if you still require access.** - -To gain access to the gomote service, file an issue with `access: gomote` as the title and cc `@golang/release`. The issue should contain an email address to a google account. The provided account will only be used for authentication purposes. - -Authentication is triggered with the first invocation of a command: - -``` -$ gomote create linux-amd64 -Please visit https://www.google.com/device in your browser and enter verification code: - ABCD-4567 -... -``` - -After opening a browser with the provided link the user must authenticate with the google account and paste the verification code into the browser. After a short wait the client will be authenticated. - -### gomote ssh - -The `gomote ssh` command uses a SSH keys created specifically for gomote. On the first use of the `gomote ssh` a set of keys will be created and stored in the local user configuration directory. You may be asked to add set a password for the keys (a password is not required). The SSH functionality operates with OpenSSH certificate authentication and does not require any additional configuration. \ No newline at end of file diff --git a/Gopher.md b/Gopher.md index 3082fe17..6b994471 100644 --- a/Gopher.md +++ b/Gopher.md @@ -1,19 +1,4 @@ -The Go gopher was designed by [Renee French](https://www.instagram.com/reneefrench/). -The design is licensed under the Creative Commons 3.0 Attributions license. -Read [this article](https://go.dev/blog/gopher) and watch [The Go Gopher A Character Study](https://www.youtube.com/watch?v=4rw_B4yY69k) for more details. +The Go wiki on GitHub has moved to go.dev (#61940). -## Where can I find more gopher illustrations? +Try or . -* [gophers in the Go website repository](https://go.googlesource.com/website/+/refs/heads/master/_content/doc/gopher/) -* [gopher vector](https://github.com/golang-samples/gopher-vector) -* [gopher 3d](https://github.com/golang-samples/gopher-3d) -* [golang graphics](https://github.com/mholt/golang-graphics) -* [print-ready swimming gopher](https://gumroad.com/l/golang) -* [go gopher vector](https://github.com/keygx/Go-gopher-Vector) -* [gopher gala](http://www.gophergala.com/) -* [gophericons](https://github.com/hackraft/gophericons) -* [gophers by Egon Elbre](https://github.com/egonelbre/gophers) -* [Go Gopher model (3d)](https://github.com/StickmanVentures/go-gopher-model) -* [Gopher Artwork by Ashley McNamara](https://github.com/ashleymcnamara/gophers) -* [Gopherize.me](https://gopherize.me/) - a Gopher avatar that's as unique as you -* [Free Gophers Pack](https://github.com/MariaLetta/free-gophers-pack) \ No newline at end of file diff --git a/HandlingIssues.md b/HandlingIssues.md index 50827afc..4d6beef6 100644 --- a/HandlingIssues.md +++ b/HandlingIssues.md @@ -1,92 +1,4 @@ -This document explains how we handle issue triage and scheduling in [the Go project's issue tracker](https://go.dev/issue). +The Go wiki on GitHub has moved to go.dev (#61940). -# Issue States +Try or . -Any issue must be in one of the following states. Project contributors move issues from one state to another. The intent behind these explicit states is to describe the (minimum) next steps required to bring the issue to resolution. Issues may move between states in any order, as dictated by the needs of the particular issue. - -### New -- The issue has been filed. -- May not be correctly formatted (title, etc). -- To transition from this state, someone must clean up the issue report and optionally CC people who might best investigate or fix it. - -### Needs Investigation -- Is correctly formatted. - - The title has a path prefix. - - The body describes the issue. -- Has a milestone. - - If the issue is not important, it is ok to set the milestone to `Backlog`. Otherwise, set it to the next upcoming release. -- Has the label `NeedsInvestigation`. - - May also have the label `WaitingForInfo` if the investigator is waiting for more information from someone (e.g., the issue reporter). -- To transition from this state, someone must examine the issue and confirm that it is valid and not a duplicate of an existing issue. - -### Needs Decision -- The issue is real, but we're not sure what action to take. - - The issue can be addressed in Go 1. - - Feedback is required from experts, contributors, and/or the community before a fix can be made. - - Note that the majority of issues will never transition to this state, as most of the time the decision is an obvious “Yes, this should be fixed.” -- Has a milestone. -- Has the label `NeedsDecision`. - - May have the label `WaitingForInfo`. - - May have the label `Blocked` if forward progress depends upon the resolution of another issue or the release of a future version of Go. An accompanying comment should explain the blockage. - - Must not have the label `Go2`. (Those issues are handled separately.) -- To transition from this state, someone must decide how the issue is to be resolved. - - If the decision is complicated, the issue may be given a [`Proposal`](https://github.com/golang/proposal/) label. The issue remains in this state until the proposal process is complete, and moves to `NeedsFix` if approved. - -### Needs Fix -- The path to resolution is known, but the work has not been done. -- Has a milestone. -- Has the label `NeedsFix`. - - May have the labels `Blocked` or `WaitingForInfo`. -- To transition from this state, someone must do the work to fix the issue. - -### Fixed -- The issue is resolved. No further attention is required. -- The issue is closed. - -Issues move from one state to another where appropriate. For example, a contributor may file an issue, assign it to themselves, and immediately apply the `NeedsFix` label. Or, an issue may go from `NeedsDecision` to `NeedsFix`, only to later move back to `NeedsDecision` as complexities arise. - -An issue may be closed at any time, with a comment to indicate the reason for closure ("fixed by …", "duplicate of …", "working as intended", etc). - -At any state (except New) the issue may be assigned to someone. -Unassigned issues are considered available for anyone to address. - - -# Milestones - -Milestones describe the timeline for issue resolution. - -- Go1.x.y - - Planned to be fixed in release 1.x.y. - -- Go1.x.y with release-blocker label - - Must be fixed for release 1.x.y, or explicitly postponed to a later release. - -- Proposal - - Is a proposal and does not pertain to a specific release. - -- Backlog - - Someone has plans to work on it, but it is not assigned to a release milestone yet. - -- Unplanned - - Might be fixed at some point, but nobody is planning to do it. - -- Unreleased - - Is not included in or needed by a release. - -- Gccgo - - For gccgo issues. - -- Go2 - - Deferred until Go 2. - -Additional milestones may be used to manage specific project work. - -The label "Soon" is used independently of milestones to indicate that the issue is time-sensitive. diff --git a/Home.md b/Home.md index 7d0605d1..66d21844 100644 --- a/Home.md +++ b/Home.md @@ -1,248 +1,4 @@ -Welcome to the Go wiki, a collection of information about the [Go Programming Language](https://go.dev/). [Awesome Go](http://awesome-go.com/) is another great resource for Go programmers, curated by the Go community. +The Go wiki on GitHub has moved to go.dev (#61940). -## Questions about Go +Try or . -See [Questions](Questions). - -Please do not ask questions by editing or creating a wiki page. Any such changes will be silently reverted. - -## Contributing - -- This wiki is open to editing by any member of the Go community with a GitHub account. -- If you would like to add a new page, please first open an issue in the [Go issue tracker](https://github.com/golang/go/issues) with the prefix 'wiki' to propose the addition. Clearly state why the content does not fit into any of the existing pages. -- Because renaming of pages in the wiki can break external links, please open an issue before renaming or removing any wiki page. - -# Table of Contents - -- [Getting started with Go](#getting-started-with-go) -- [Working with Go](#working-with-go) -- [Learning more about Go](#learning-more-about-go) -- [The Go Community](#the-go-community) -- [Using the go toolchain](#using-the-go-toolchain) -- [Additional Go Programming Wikis](#additional-go-programming-wikis) -- [Online Services that work with Go](#online-services-that-work-with-go) -- [Troubleshooting Go Programs in Production](#troubleshooting-go-programs-in-production) -- [Contributing to the Go Project](#contributing-to-the-go-project) -- [Platform Specific Information](#platform-specific-information) -- [Release Specific Information](#release-specific-information) -- [Questions](Questions) - -## Getting started with Go - -- [The Go Tour](https://go.dev/tour/) is the best place to start. -- [Effective Go](https://go.dev/doc/effective_go) will help you learn how to write idiomatic Go code. -- [Go standard library documentation](https://pkg.go.dev/std) to familiarize yourself with the standard library. -- [Use the Go Playground](https://go.dev/play) to test out Go programs in your browser. -- Still not convinced? Check out this list of [Go Users](GoUsers) and a few of their [Success stories](SuccessStories). We've also assembled a long list of reasons [why you should give Go a try](whygo). -- Read about the companies which have [switched from other languages to Go](https://github.com/golang/go/wiki/FromXToGo). - -## Working with Go - -Ready to write some Go code of your own? Here are a few links to help you get started. - -- Install and Setup your Environment - - Start here: [Official Installation Documentation](https://go.dev/doc/install) - - If you prefer to install from source, [read this first](https://go.dev/doc/install/source). - - [InstallFromSource](InstallFromSource) - Additional tips on source installs. - - Windows user? [Install and configure Go, Git, and Visual Studio Code for Windows](https://github.com/abourget/getting-started-with-golang) - - Mac user? [How I start - Go](https://howistart.org/posts/go/1) - A step-by-step guide to installing Go and building your first web service. - - Having installation problems? [InstallTroubleShooting](InstallTroubleShooting) - - Make sure you have your [$GOPATH environment variable set correctly](https://go.dev/doc/install/source#gopath) - - If you need additional tips on using [$GOPATH, go here](GOPATH). - - [MultipleGoRoots](MultipleGoRoots) - More advanced information on working with multiple go installations and the `$GOROOT` variable. -- [Go IDEs and Editors](IDEsAndTextEditorPlugins) - Information on how to use your favorite editor with Go. -- [Tools for working with Go code](CodeTools) - Formatting, linting, vetting, refactoring, navigation, and visualization. -- Finding Go Libraries and Packages - - Start here: [Go open source projects](Projects). - - Search for Go packages: [pkg.go.dev](http://pkg.go.dev) - - Visualization of the [Go open-source package graph](https://anvaka.github.io/pm/#/galaxy/gosearch?l=1) -- [Modules](Modules) - documentation on the dependency management system built into the Go command, added in 1.11. -- [Managing your dependencies](PackageManagementTools) - An overview of the tools you can use to manage third-party packages (vendoring). -- Publishing Go Packages as Open Source - - Getting ready to publish your package? [Start here.](PackagePublishing) - - [The Go Checklist](https://github.com/matttproud/gochecklist) - A comprehensive guide for publishing a project. - - [How to layout your GitHub repo](GitHubCodeLayout) to make it easy for other Go programmers to use with the `go get` command. - - [Go Package, Go](https://johnsto.co.uk/blog/go-package-go) - A few recommendations for making Go packages easy to use. - -## Learning more about Go - -Once you have an overview of the language, here are resources you can use to learn more. - -- [Learning Go](Learn) - A collection of resources for learning Go - beginner to advanced. - - [Best Practices for a New Go Developer](https://www.cloudbees.com/blog/best-practices-for-a-new-go-developer) - Insights from Go community members. - - [Server programming](LearnServerProgramming) - Building web, mobile, and API servers. - - [More on concurrency](LearnConcurrency) - - [More on error handling](LearnErrorHandling) - - [More on testing](LearnTesting) - - [More on mobile - Android and iOS](Mobile) -- [Books](Books) - A list of Go books that have been published (ebook, paper). -- [Blogs](Blogs) - Blogs about Go. - - [Podcasts](Podcasts) - Podcasts and episodes featuring Go. -- Videos, Talks, and Presentations - - [GopherVids](http://gophervids.appspot.com/) (currently unreachable) is a searchable index of videos about Go. - - [GoTalks](GoTalks) - A collection of talks from Go conferences and meetups. - - [Livestreams](Livestreams) - live interactive Go project streams with members of the community. - - [Screencasts](Screencasts) -- [Articles](Articles) - A collection of articles to help you learn more about Go. -- [Training](Training) - Free and commercial, online, and classroom training for Go. -- [University Courses](Courses) - A list of CS programs and classes using Go. -- [Resources for non-English speakers](NonEnglish) - -## The Go Community - -Here are some of the places where you can find Gophers online. To get a sense of what it means to be a member of the Go community, read [Damian Gryski's keynote from the GolangUK 2015 conference](https://medium.com/@dgryski/the-go-community-f0d00e3a19e) or watch [Andrew Gerrand's closing keynote from GopherCon 2015](https://www.youtube.com/watch?v=0ht89TxZZnk). - -- Where Gophers hangout online: - - [The Go Forum](https://forum.golangbridge.org/) - An all-purpose discussion forum for the Go community. - - [Gophers Slack Channel](http://gophers.slack.com/) - For real-time chat ([request membership](http://blog.gopheracademy.com/gophers-slack-community/)). - - [Golang News](http://golangnews.com) - For curated links about Go Programming. - - There is also a [/r/golang](http://reddit.com/r/golang) sub-reddit. - - On Twitter, follow the [@golang](https://twitter.com/golang) account and keep tabs on the [#golang](https://twitter.com/search?q=%23golang&src=typd) hashtag. - - We've also got a landing page on [Stack Overflow](http://stackoverflow.com/tags/go) for Go Q&A. - - Matrix enthusiasts are invited to join [#Go:matrix.org](https://riot.im/app/#/room/#Go:matrix.org). - - Discord users are welcome at the [Discord Gophers](https://discord.gg/golang) server. - - Hashnode users talk and write about Go in [Hashnode Go community](https://hashnode.com/n/go). -- Mailing Lists - - The mailing list for Go users is [golang-nuts](https://groups.google.com/forum/#!forum/golang-nuts) - very high traffic. - - Before you post, [check to see if it's already been answered](http://stackoverflow.com/tags/go), then read [these tips on how to ask a good question](HowToAsk) - - For discussions about the core Go open source project, join [golang-dev](https://groups.google.com/forum/#!forum/golang-dev). - - To get just our release announcements, join [golang-announce](https://groups.google.com/forum/#!forum/golang-announce) -- User Groups & Meetups - There are [Go Meetups in many cities](http://www.meetup.com/find/?allMeetups=false&keywords=golang&radius=Infinity&userFreeform=Sunnyvale%2C+CA&mcId=z94086&mcName=Sunnyvale%2C+CA&sort=recommended&eventFilter=mysugg) - - [GoBridge](http://golangbridge.org) - Volunteers helping underrepresented communities to teach technical skills and to foster diversity in Go. - - [Women Who Go](http://www.womenwhogo.org/) - - See here for [additional information GoUserGroups](GoUserGroups) - - [GoDiscourse](https://github.com/godiscourse/godiscourse) - Go Discourse is an open-source Go-based forum from `hello world`. -- [Conferences](Conferences) - A list of upcoming and past Go conferences and major events. -- [Companies using Go](GoUsers) - A comprehensive list of companies using Go throughout the world. -- Learn more about the [Go Gopher images](Gopher) by Renee French. - -## Using the Go Toolchain - -- Start with the standard documentation for the `go` command [available here](https://pkg.go.dev/cmd/go/) -- Start here to learn about [vendoring](https://pkg.go.dev/cmd/go/#hdr-Vendor_Directories). -- See also [PackageManagementTools](PackageManagementTools) for package management tools. -- [Cross Compilation](https://rakyll.org/cross-compilation/) -- Shared libraries and Go (buildmode) - - [Go Shared Libraries](https://github.com/jbuberel/buildmodeshared) - Examples for creating and using shared libraries from Go and Python. - - [Sharing Go Packages with C](http://blog.ralch.com/tutorial/golang-sharing-libraries/) - by [@ralch](https://twitter.com/ralch). - - [Calling Go libraries from Python](https://blog.filippo.io/building-python-modules-with-go-1-5/) - by Filippo Valsorda - - [Calling Go libraries from Ruby](http://c7.se/go-and-ruby-ffi/) - by Peter Hellberg - - [Calling Go libraries from Swift](https://rakyll.org/swift/) - by Jaana Burcu Dogan - - [Build a Ruby Gem with a Go native extension](http://blog.paracode.com/2015/08/28/ruby-and-go-sitting-in-a-tree) - by @jondot - - [gohttplib](https://github.com/shazow/gohttplib) - An experiment in using Go 1.5 buildmode=c-shared. -- See the wikis below for additional details: - - [GoGetTools](GoGetTools) - - [GoGetProxyConfig](GoGetProxyConfig) - - [cgo](cgo) - - [CompilerOptimizations](CompilerOptimizations) - - [GccgoCrossCompilation](GccgoCrossCompilation) - - [GcToolchainTricks](GcToolchainTricks) - - [GoGenerateTools](GoGenerateTools) - - [Go Tooling Essentials](https://rakyll.org/go-tool-flags/) - by Jaana Burcu Dogan - -## Additional Go Programming Wikis - -- Concurrency - - [Timeouts](Timeouts) - Abandon async calls that take too long - - [LockOSThread](LockOSThread) - - [MutexOrChannel](MutexOrChannel) - When to use one vs the other - - [RaceDetector](RaceDetector) - How to detect and fix race conditions -- Working with Databases - - [database/sql](http://go-database-sql.org/) - Online tutorial for working with the database/sql package. - - [SQLDrivers](SQLDrivers) - - [SQLInterface](SQLInterface) -- From other languages - - [Go for Java Programmers](http://yourbasic.org/golang/go-java-tutorial/) - - [Go for C++ Programmers](GoForCPPProgrammers) -- Strings - - [GoStrings](GoStrings) - - [String Matching](http://blog.gopheracademy.com/advent-2014/string-matching/) -- [Comments](Comments) -- [CommonMistakes](CommonMistakes) -- [Errors](Errors) -- [GcToolchainTricks](GcToolchainTricks) -- [InterfaceSlice](InterfaceSlice) -- [Iota](Iota) -- [MethodSets](MethodSets) -- [PanicAndRecover](PanicAndRecover) -- [Range](Range) -- [RateLimiting](RateLimiting) -- [SignalHandling](SignalHandling) -- [SimultaneousAssignment](SimultaneousAssignment) -- [SliceTricks](SliceTricks) -- [Switch](Switch) -- [TableDrivenTests](TableDrivenTests) - -## Online Services that work with Go - -If you're looking for services that support Go, here's a list to get you started. - -- Cloud Computing - Go is well supported by most cloud service providers. - - [Amazon Web Services](https://github.com/aws/aws-sdk-go) - - [Azure](https://github.com/Azure/azure-sdk-for-go) - - [DigitalOcean](https://github.com/digitalocean/godo) - - [GE Predix](https://github.com/geaviation/goboot-starter) - - [Google Cloud Platform for Go](https://cloud.google.com/go) - - [Heroku](https://github.com/heroku/heroku-buildpack-go) - - [IBM Bluemix](https://developer.ibm.com/bluemix/2015/10/28/getting-started-with-golang-on-bluemix/) - - [OpenStack](https://github.com/openstack/golang-client) - - [Vscale](https://github.com/vscale/go-vscale) - - [Aliyun](https://github.com/aliyun/alibaba-cloud-sdk-go) - - [Tencent](https://github.com/TencentCloud/tencentcloud-sdk-go) - - See here for [information on additional providers](ProviderIntegration) -- [Continuous Integration and Continuous Deployment](HostedContinuousIntegration) - Go is well supported by most CI/CD frameworks -- Monitoring/Logging - - [OpsDash](https://www.opsdash.com/) - Go-based cluster monitoring platform. -- Package and Dependency Management - - [Gopkg.in](http://labix.org/gopkg.in) is a source for stable Go libraries, provided by Gustavo Niemeyer. - -## Troubleshooting Go Programs in Production - -- Understand the performance of your Go apps using the [pprof package](https://go.dev/blog/profiling-go-programs) -- Heap Dumps - - [[heapdump13]] - - [[heapdump14]] - - [[heapdump15-through-heapdump17]] - -## Contributing to the Go Project - -- Start by reading the [Go Contribution Guidelines](https://go.dev/doc/contribute) -- If you'd like to propose a change to the Go project, start by reading the [Go Change Proposal Process](https://github.com/golang/proposal) - - An archive of [design documents is also available](DesignDocuments) -- Go releases happen at ~6-month intervals. [See here for more information](Go-Release-Cycle) -- Want to know more about how the [Go source X-repositories are structured?](X-Repositories) -- The Go project requires that all code be reviewed before it is submitted. - - Read more about our [code review practices](CodeReview) - - If you're commenting on code under review, please read [these guidelines](CodeReviewComments) -- Issues - - Bug reports and feature requests should be filed using the [GitHub issue tracker](https://github.com/golang/go/issues) - - Want to understand how we [handle issues that are reported?](HandlingIssues) -- Project Dashboards - - [Go Builds Dashboard info](DashboardBuilders) - - [Performance Dashboard info](PerfDashboard) - - [Download failed logs and debugging](https://github.com/golang/go/wiki/Download-build-farm-failed-logs-and-debugging) - -## Platform Specific Information - -See [MinimumRequirements](MinimumRequirements) for minimum platform requirements of current Go ports. Considering porting Go to a new platform? [Read our porting policy first](PortingPolicy). - -- [ChromeOS](ChromeOS) -- [Darwin](Darwin) -- [DragonFly BSD](DragonFly-BSD) -- [FreeBSD](FreeBSD) -- [Go on ARM](GoArm) -- [Linux](Linux) - - [Ubuntu](Ubuntu) -- [Mobile](Mobile) -- [NetBSD](NetBSD) -- [OpenBSD](OpenBSD) -- [Plan 9](Plan9) -- [Solaris](Solaris) -- [Windows](Windows) - - [WindowsBuild](WindowsBuild) - - [WindowsCrossCompiling](WindowsCrossCompiling) - - [WindowsDLLs](WindowsDLLs) - -Notes: - -- Please refrain from changing the title of the wiki pages, as some of them might be linked to from [golang.org](https://golang.org) or other websites \ No newline at end of file diff --git a/HostedContinuousIntegration.md b/HostedContinuousIntegration.md index 850b5c32..2803ff32 100644 --- a/HostedContinuousIntegration.md +++ b/HostedContinuousIntegration.md @@ -1,13 +1,4 @@ -A number of hosted continuous integration platforms have support for Go +The Go wiki on GitHub has moved to go.dev (#61940). + +Try or . -| Provider | Documentation | Notes | -|:---------|:--------------|:------| -| [AppVeyor](http://www.appveyor.com/) | [docs](https://bitbucket.org/appveyor/test-go) | Windows | -| [CircleCI](https://circleci.com/) | [docs](https://circleci.com/docs/language-go/)| [howto-1](http://stackengine.com/golang-with-circleci/) [howto-2](https://medium.com/@jgautheron/publish-your-golang-binaries-in-github-with-circleci-e0b64cb21bf8) | -| [Codeship](http://codeship.io) | [docs](https://www.codeship.io/documentation/languages-and-frameworks/go/) | | -| [drone.io](http://drone.io/) | [docs](http://docs.drone.io/golang.html) | [open-source version](https://github.com/drone/drone) | -| [Jenkins](https://jenkins-ci.org/) | [docs](https://wiki.jenkins-ci.org/display/JENKINS/Go+Plugin) | | -| [Magnum CI](https://magnum-ci.com/) | [docs](https://magnum-ci.com/docs/go) | | -| [Travis CI](http://travis-ci.org) | [docs](http://docs.travis-ci.com/user/languages/go/) | [howto](http://loads.pickle.me.uk/2015/08/22/easy-peasy-github-releases-for-go-projects-using-travis/), [go-client-api](https://github.com/AbletonAG/go-travis) | -| [Azure Devops](https://www.visualstudio.com/team-services/) | [docs](https://docs.microsoft.com/en-us/vsts/build-release/apps/go/go) | | -| [Wercker](http://wercker.com/) | [docs](http://devcenter.wercker.com/quickstarts/building/golang.html) | | | diff --git a/How-to-ask-for-help.md b/How-to-ask-for-help.md index 30f92d64..c631506a 100644 --- a/How-to-ask-for-help.md +++ b/How-to-ask-for-help.md @@ -1,60 +1,4 @@ -This page gives some hints on how to successfully ask for help in the various [Go support forums][3]. +The Go wiki on GitHub has moved to go.dev (#61940). -## Before you ask your question +Try or . -Before asking for help, please check that you've addressed the following common issues: - -### Always check all errors - -Always check all errors. It is common to see problems reported related to nil panics due to code like this -``` -result, err := somefunction() -if err != nil { - log.Println("oops an error happened", err) - // return is missing here -} -// the code then continues to use result which is invalid. -``` -or -``` -result, _ := somefunction() -// code uses result which might be invalid -``` -You should make sure it is clear that your code is correctly handling all error conditions before asking for help. - -Further reading: -- [Error handling and Go][0] - -### Check that your code is free from data races - -Unexpected runtime panics are often caused by data races in your program. If your program contains a data race you need to address the race before asking for help. - -If your program has good test coverage you can test for races by adding the `-race` flag to your `go test` invocation. - -If your program does not have good test coverage or the crash only happens when running the program, you can build a race enabled version of your program by passing `-race` to your `go build` or `go install` invocation. - -_The behaviour of a Go program with a data race is undefined. There are no safe data races in Go programs._ - -Further reading: -- [Introducing the race detector][1] - -## Asking questions - -The best way to get help is to show - -1. **What you did, ideally with a small complete, stand-alone, example.** - If you ran a command, show the command that you ran. If your program failed, provide the source of the program that failed. If the program is too large, or you cannot share the source, instead provide a self contained, runnable example, that demonstrates the problem. -2. **What you expected to happen.** If you expected the command to complete successfully, say that. If you expected the program to produce a particular output, give an example of the output you expected. -3. **What happened instead.** - If the command failed, include the full output of the failure, not just a single line that you though was the cause. If the program failed to produce the expected output, include what it did output. - -## Additional tips - -- If you are posting the output of a command, paste the text, not a screenshot of the text. If it's actually an image, that's ok. -- If you are posting a large amount of output, you may consider using a pastebin or gist service. -- When posting code samples, use the [Go playground][2] (unless it is unavailable in your country). - -[0]: https://go.dev/blog/error-handling-and-go -[1]: https://go.dev/blog/race-detector -[2]: https://go.dev/play -[3]: https://github.com/golang/go/wiki/questions \ No newline at end of file diff --git a/HowToAsk.md b/HowToAsk.md index a3914893..a59fbc14 100644 --- a/HowToAsk.md +++ b/HowToAsk.md @@ -1,112 +1,4 @@ -# A quick introduction +The Go wiki on GitHub has moved to go.dev (#61940). -Imagine you want to know how to get from "Old street" to "New street". You call a random person to get help and you ask "What is the fastest way I can get from Old street 19 to New street 3?". Would the random person be able to help you? +Try or . -There are a lot of "New" and "Old" streets in the world, so first he would need to know what country and city you are in. If the street layout is complicated then maybe you need to name some buildings that are near you. Of course because speed is an issue then your means of transportation is also important; are you by foot, bike, car or truck? You can go on foot into places where you can't get by truck. - -Those questions around the immediate question "How do I X?" is the context of the problem, it helps other people orient to the problem. Giving advice without context could mean that the other person will describe the wrong city. - -In person it's easy to ask those questions and can be done in rapid succession, although on the forums this will result in a lot of back-and-forth questions that can be avoided. So, how to properly give the context to the problem? - -# How to ask a good question - -People on the forums have limited time available. So, to speed things up, here is a small template for asking a question that will get better answers and answers quicker: - -> The gist of the problem you are having.
-

-How did you encounter the problem?
-What are you trying to accomplish?
-What is the context of the problem?
-What are the requirements for the solution?
-What are the context-specific constraints/properties?
-Your compilable and runnable example on play.golang.org
-
-Other notes about the situation (production/school/playing/learning)
- -Things to keep in mind:
-
  • Take your time to spell-check and make sure that your sentences are readable.
    -
  • The solution can be far away from the immediate problem. So be sure that the question contains answers to the 5 whys. The template implicitly already contains answers to 3 whys.
    -
  • The context of the question is important, so always give one. Not giving the context may end up hurting you, because you’ll get an answer that’s more suited to a different context. The context is the end-user or domain problem and goal, with the information how it tries to solve it.
    -
  • Try not to ask abstract questions but if you do then add multiple concrete examples. Asking abstract things without concrete examples (usually) wastes time. Although they can be sometimes interesting, the concrete examples allow the discussion to be precise.
    -
  • Avoid imprecise terms such as "a lot of data" or "needs to work fast". Give something measurable such as "it needs to work upto 1GB of data" or "it needs to communicate with 1000 concurrent clients within 100ms".
    -
  • If you are not able to give the compilable example in go, any language will do... many people are well versed in other languages. If you are not able to make it compile or run, it's fine too.
    -
  • Try to explain your situation:
    -
    • Noting that "it is homework" means people can explain a bit more and won't do the homework for you.
      -
    • Information such as "it needs to work on a cluster of X nodes" can provide situational context. Where and how the code must eventually run.
      -
    • Noting that "it’s for learning X" makes it clear that you are trying to get a deeper understanding of different approaches.
      -
    • Noting that "I’m under NDA and can’t disclose the code", means people won’t bother asking for it. Although you should still try to come up with a similar situation, it helps the answerer.
      -
  • Giving a simplified example can be helpful for readers, but do not forget to give the full version as well. The simplified version is different from the full version and therefore the solutions can be different.
- -Of course, don't worry too much... you can't answer all possible questions. It's not needed to write a 4 page essay on the whole thing. People can always ask when something needs clarification.
-
-

The story of a bad question

- -Why is that template necessary? Let's put you in the shoes of the answerer, and let's say you get this question:
-
-
How do I use the reflect Set method?
- -From the askers perspective this may look like a straightforward problem. Of course, you have no idea what the asker is trying to do. Is he trying to set a value on a value, struct, array or a map? This means you need to ask the first question: Can you give an example?.
-
-Now the asker will provide an example:
-
-
I'm basically trying to do this:
-
    m := make(map[string]int)
- v := reflect.ValueOf(m)
- key := reflect.ValueOf("hello")
- val := reflect.ValueOf(123)
- v.MapIndex(k).Set(val)
- print(m)
-
-But it just panics.
- -Now you've got some code that even doesn't compile. This means you need to copy paste it somewhere and fix the mistakes. Putting it on play.golang.org makes it easier to see the problem (e.g. play.golang.org/p/fCxBlL9V4Y).
-
-The fix is simple; just use SetMapIndex instead. Of course that may not be the full story. The asker now comes back with another problem:
-
-
Yay, I've got the reflection working, but it's not fast enough.
-How can I make it faster?
- -What does "faster" mean? What is he trying to do? So you need to ask more about the specifics of the problem. So you ask: What are you trying to accomplish? - -
I'm trying to implement a set package that can store generic types.
- -Well, ok, but that still didn't answer why it needs to be faster. Why is he using reflect for that anyway, when you can use map instead. So you answer: Can't you just use map instead (e.g. map[type]struct{})? What are you writing the set package for?. - -
I'm writing a program that goes over multiple sequences and that finds the common elements.
-The main use for is for using on nucleotides and it should work on large datasets. But it should also work on proteins, which are represented by another type.
- -
Yes, the map[NucleotideIndex]struct{} works a bit better, but it's still not fast enough, and I would now have to write the same code for proteins.
- -Finally we have all the information that's needed. The solution is straightforward: biogo https://code.google.com/p/biogo/ has most of the stuff necessary for handling large datasets and parallelism etc. Also what's the "NucleotideIndex". The asker may have found the answer and say: Thanks that's really nice. but there is a possibility of:
-
-
Whoa, that looks nice, but I'm in a bioinformatics course and we need to write that code ourselves. The "NucleotideIndex" is a "struct {Nucleotide Nucleotide; Index int}".
- -That looks weird, why would you do it that way. Nevertheless we've all done something stupid, so... now you can start suggesting something better: Probably dealing with map[Type]map[int]struct{} would be much easier. Because you are dealing with sequences and the set elements are always used in an increasing order you can just store the index in an array e.g. map[Type][]int. Also if the memory starts to become the problem you could make it into a run-length-encoded set... - -Now we can have a more meaningful discussion about the (dis)advantages of different set types.
-
-Hopefully after this long example, you probably understand why it's useful to provide more information. The initial back and forth questions could have been avoided. Proper question could have saved time for the question asker and the answerer.
-
-The initial question could have been:
-
-
How do I use the reflect Set method with MapIndex?
-
-I'm trying to set a value on a generic map for a set package. But it just gives a panic when I try to do that. play.golang.org/p/fCxBlL9V4Y
-
-I use the set package in a program that goes over multiple sequences and find all the common elements in a sequence. The sequence elements could be nucleotides or proteins. The program needs to be able to deal with data-sizes upto 1GB.
-
-My current code is available at github.com/...
-
-I'm writing this for a bioinformatics course, so I need to implement it myself.
- -Summary:
-
-
  • The best answer depends on the context. In some cases maybe research.swtch.com/sparse would be more appropriate. If the speed isn't important using a map would be sufficient. So the requirements are also important.
    -
  • The problem can be somewhere else. As you saw the answerer didn't expect that the structure of the program was at fault. Using a struct NucleotideIndex with a map, meant he had to build elaborate things with reflection. Often when you fix the higher-level problem, everything else will become much easier.
    -
  • Constraints/properties matter. The property "set elements are used in increasing order" meant that there was a simple method that didn't require a full-blown set implementation. This specialized structure can be much faster. The information about the system, context or domain may make the problem much simpler.
    -
  • The solution may differ from your usual approaches. Maybe the asker decided to use reflect package, because he was used to generics in Java. Go is different language, so the final solution may look a lot different from the solution in Java.
- -

More tips

- -
  • Smart questions -
  • Short, Self Contained, Correct (Compilable), Example diff --git a/IDEsAndTextEditorPlugins.md b/IDEsAndTextEditorPlugins.md index 2405a687..eec5fa16 100644 --- a/IDEsAndTextEditorPlugins.md +++ b/IDEsAndTextEditorPlugins.md @@ -1,62 +1,4 @@ -# Editors and IDEs for Go -## Popular -The [Go Developer Survey](https://go.dev/blog/survey2021-results) showed these as the most popular editors. - * **[Visual Studio Code](https://code.visualstudio.com/)**: Free & open source IDE by Microsoft. Visual Studio Code supports Go syntax highlighting out of the box. Additional features are provided by the official [vscode-go](https://github.com/golang/vscode-go) plugin. - * **[GoLand](https://www.jetbrains.com/go/)**: JetBrains's cross-platform, [fully featured](https://www.jetbrains.com/go/features/) Go IDE (commercial). Free for students, teachers, open-source developers, and user-groups ([see details](https://www.jetbrains.com/go/buy/#edition=discounts)). Also available as part of IntelliJ IDEA Ultimate. +The Go wiki on GitHub has moved to go.dev (#61940). - * **[Vim](http://www.vim.org/)** & **[Neovim](https://neovim.io/)**: Vi Improved. There are a number of plugins available that make editing Go code easier. - * The [vim-go](https://github.com/fatih/vim-go) plugin includes misc/vim and has many other new improvements. - * The [Syntastic](https://github.com/scrooloose/syntastic) plugin gives instant feedback on compile errors - * The [tagbar](https://github.com/majutsushi/tagbar) plugin uses Gotags, above, to show an outline of the current file - * A [vim compiler plugin](https://github.com/rjohnsondev/vim-compiler-go) for syntax checking - * A [vim-godef](https://github.com/dgryski/vim-godef) plugin integrates with the 'godef' tool, above - * A [vim-go-extra](https://github.com/vim-jp/vim-go-extra) is vim plugin based on misc/vim in go repository. This works fine on windows too! - * The [go-ide](https://github.com/plentiform/go-ide) is a Neovim configuration file that ties go related plugins together making autocomplete, auto-importing, snippets, code formatting, and file search/browsing easier. - * [govim](https://github.com/govim/govim) is an LSP-driven vim plugin for Go development, written in Go using Vim8’s channel support. - * **[Emacs](https://www.gnu.org/software/emacs/)**: Extensible and customizable text editor. It has generic LSP support that works well with gopls, the official Go language server. - * **[LSP Mode](https://emacs-lsp.github.io/lsp-mode/)** provides LSP support with a batteries-included approach, with many integrations enabled “out of the box” and several additional behaviors provided by lsp-mode itself. - * **[Eglot](https://github.com/joaotavora/eglot/blob/master/README.md)** provides LSP support with a minimally-intrusive approach, focusing on smooth integration with other established packages. It provides a few of its own eglot- commands but no additional keybindings by default. - * Mode file maintained at https://github.com/dominikh/go-mode.el. - * [GoFlyMake](https://github.com/dougm/goflymake) Flymake-style syntax checking for Go - * [go-errcheck.el](https://github.com/dominikh/go-errcheck.el) Errcheck integration for Emacs - * [flycheck-metalinter](https://github.com/favadi/flycheck-gometalinter) Flycheck integration for go-metalinter utility - * [go-playground](https://github.com/grafov/go-playground) Local playground inside Emacs +Try or . -## Less popular -These editors are less popular, and may have less modern Go support. In particular, they may not support Go modules. - * **[Atom](https://atom.io/)**: JavaScript-based editor from GitHub. Go support at [go-plus](https://github.com/joefitzgerald/go-plus) - * **[BBEdit](https://www.barebones.com/products/bbedit/)**: free text editor for macOS (with paid upgrade for pro features). - * Go support available with the [Go-bbpackage module](https://github.com/ascarter/go-bbpackage) including syntax highlighting, clippings, ctags standard library completion, and tools - * **[Brackets](http://brackets.io)**: a modern, open source text editor that understands web design. - * [go-ide](https://github.com/David5i6/Brackets-Go-IDE) Go support with autocompletion through gocode. - * **[Chime](https://www.chimehq.com)**: Capable. Focused. Fast. A Go editor for macOS. - * **[CodeLobster IDE](https://www.codelobster.com)** Smart free cross-platform IDE with built-in Go support - * **[CodePerfect 95](https://codeperfect95.com)**: A blazing fast IDE for Go. - * **[jEdit](http://www.jedit.org/)**: open-source, cross-platform text editor written in Java. [Syntax-highlighting file available](https://code.google.com/archive/p/go-stuff/source/default/source). - * **[Kate](https://kate-editor.org/)** Kate is an advanced, cross-platform text editor developed by KDE, with Go support out-of-the-box. - * **[Komodo IDE](https://www.activestate.com/komodo-ide)** Powerful cross-platform IDE with built-in Go support - * **[Komodo Edit](https://www.activestate.com/komodo-edit)** Powerful cross-platform text editor, Go-lang support available via [plugin](https://github.com/Komodo/komodo-go) - * **[LiteIDE](https://github.com/visualfc/liteide)**: A simple, open source and cross-platform Go IDE - * **[Micro](https://micro-editor.github.io)**: A modern and intuitive terminal-based text editor written in Go - * Go language support (gofmt and goimports) via [plugin](https://micro-editor.github.io/plugins.html#c-go) - * **[Notepad++](http://notepad-plus-plus.org/)**: Free source code editor for Windows. - * [notepadplus-go](https://github.com/chai2010/notepadplus-go) Syntax highlighting, functions list panel (for code browsing), code completion for keywords & builtins. - * The GOnpp plugin (available **via Notepad++'s built-in Plugin Manager**) provides code completion (requires gocode), function calltips, goimports integration, and keyboard shortcuts for common go commands. [[sources](https://github.com/tike/GOnpp), [binaries](http://sourceforge.net/projects/gonpp/files/)]. - * [GoAutocomplete](https://github.com/steve-perkins/GoAutocomplete) is another code completion plugin. - * **[Nova](https://nova.app)**: Native Mac code editor. - * [Go Language Definition for Nova](https://extensions.panic.com/extensions/gwynethllewelyn/gwynethllewelyn.Go/) — _Go syntax highlighting and interface with the Language Server Protocol (LSP) using Google's official [`gopls`](https://pkg.go.dev/golang.org/x/tools/gopls) language server for Go (if installed)._ - * [Go Tools](https://extensions.panic.com/extensions/cloudmanic/cloudmanic.GoTools/) — _Run `goimports` on save or via a command. Syntax highlighting for Go._ - * **[Source Insight](https://www.sourceinsight.com)**: Commercial programming editor & code browser with built-in live analysis for C, C++, C#, Java, and more; helping you understand large projects. - * [golang.xclf](https://www.sourceinsight.com/pub/languages/golang.xclf) is a [Custom Language](https://www.sourceinsight.com/download/custom-languages/) file adding syntax formatting and some parsing support to Source Insight for Go language. - * **[Sublime Text](http://www.sublimetext.com/)**: Commercial text editor. - * (Sublime Text 4 only) [LSP + gopls](https://lsp.sublimetext.io/language_servers/#go) is a plugin collection with IDE-like features available. - * [GoSublime](https://github.com/DisposaBoy/GoSublime) is a plugin collection with IDE-like features available. - * [Golang Build](https://github.com/golang/sublime-build) is the official Sublime Text package for Go build system integration. - * **[Textadept](http://foicica.com/textadept/)**: Textadept is a fast, minimalist, and remarkably extensible cross-platform text editor. Supports Go syntax highlighting out of the box. - * **[TextMate](http://macromates.com/)**: Commercial text editor for macOS. [Source code available](https://github.com/textmate/textmate) under the GPLv3. [Bundle for Go available](https://github.com/syscrusher/golang.tmbundle). - * **[Zed](https://zed.dev)**: Code at the speed of thought. - -## Cloud Based IDEs - - * **[Cloud9](https://aws.amazon.com/cloud9/)**: claims full Go support. - * **[Gitpod](https://gitpod.io)**: GitHub integrated cloud IDE with full Go support. diff --git a/InstallFromSource.md b/InstallFromSource.md index 08d9c4eb..9e735a3e 100644 --- a/InstallFromSource.md +++ b/InstallFromSource.md @@ -1,27 +1,4 @@ -# Introduction +The Go wiki on GitHub has moved to go.dev (#61940). -This is a companion to https://go.dev/doc/install/source providing additional instructions for various operating systems. +Try or . -## Install C tools - -On OS X, a C compiler is bundled in the command line tools for -[Xcode](http://developer.apple.com/Xcode/), -and you don't need to install the whole Xcode to compile Go. -If you have already installed Xcode 4.3+, you can install command -line tools from the Components tab of the Downloads preferences panel. -In more recent versions of Xcode, you can use ` xcode-select --install ` -command to install the command line tools without opening Xcode. -To verify you have a working compiler, just invoke ` gcc ` -in a freshly created Terminal window, unless you see the -` "gcc: command not found" ` error, you are ready to go. - -On Ubuntu/Debian, use ` sudo apt-get install gcc libc6-dev `. -If you want to build 32-bit binaries on a 64-bit system you'll also need the ` libc6-dev-i386 ` package. - -On RedHat/Centos 6, use ` sudo yum install gcc glibc-devel `. -If you want to build 32-bit binaries on a 64-bit system you'll need both -` glibc-devel.i386 ` and ` glibc-devel.x86_64 ` packages. - -On Windows, install ` gcc ` with -[TDM-GCC](http://tdm-gcc.tdragon.net/). or try [TDM-GCC Sourceforge link](https://sourceforge.net/projects/tdm-gcc/). -(Make sure you add its ` bin ` subdirectory to your ` PATH `.) Go does not support the Cygwin toolchain. diff --git a/InstallTroubleshooting.md b/InstallTroubleshooting.md index baf78216..7c709238 100644 --- a/InstallTroubleshooting.md +++ b/InstallTroubleshooting.md @@ -1,72 +1,4 @@ -# Introduction +The Go wiki on GitHub has moved to go.dev (#61940). -There are many times in which you may install Go (either from source or from a binary distribution) and things don't work quite right. This page is meant to collect some common wisdom about problems that are relatively common or difficult to diagnose and provide tips and solutions. +Try or . -# Contents - * [Introduction](#introduction) - * [Tips](#tips) - * [Environment](#environment) - * [GOROOT vs GOPATH](#goroot-vs-gopath) - * [Troubleshooting](#troubleshooting) - * [Still need help?](#still-need-help) - -# Tips -## Environment - -To start out with, check the following first: - * GOROOT - * This should _only_ be set if you used a binary distribution and it's not installed in the default location. - * [GOPATH](https://pkg.go.dev/cmd/go#GOPATH_environment_variable) - * This should be set to the directory under which you want your source (and third party packages). - * This can also be set to a list of absolute paths separated by : (or ; on Windows). - * Note that ~/some/path is not absolute and will probably not work the way you expect (try $HOME/some/path instead). - * GOPATH should not be set to or contain GOROOT - * GOBIN - * This should only be set if you _really_ know what you're doing... The default should be fine. - * GOOS, GOARCH, GOHOSTOS, GOHOSTARCH - * You shouldn't need to set these in normal cases. - -Under linux and darwin, make sure that any of the above variables which are set are actually exported. When you run the ` env | grep GO ` command, they should be listed. You can also check your environment with the ` go env ` command. In bash, this is done with the ` export GOPATH ` (if it's already set) or ` export GOPATH=/path/to/gopath ` command (similarly for the other variables), usually in your .bashrc or .bash\_profile. - -## GOROOT vs GOPATH -Packages under GOROOT store their source files in - -` $GOROOT/src/pkg/import/path/*.go ` - -Notice that this is ` src/pkg `; under GOPATH, source files are stored in - -` $GOPATH/src/import/path/*.go ` - -Because of this inconsistency, it is generally not recommended that GOPATH be set to or contain GOROOT; its directories will be searched automatically for imports regardless of the GOPATH setting. - -# Troubleshooting -#### The ` go build ` command doesn't do anything! -The ` go build ` command will only produce a binary; if you run go build in a package directory, it will build the package normally (and report any compile errors), but it will not install it. For that, you use ` go install `. If you think you're building a binary and none is produced, make sure you are in package ` main ` and that you do not have GOBIN set. - -#### Why does ` go get ` report ` "Fetching https://runtime/cgo?go-get=1" `? -If you have a source distribution, make sure that your packages are up-to-date. Also double check the environment above. - -#### When cross compiling, I get ` "runtime/extern.go:135: undefined: theGoos" ` -Read [[WindowsCrossCompiling]] for some helpful scripts. You can also use the ` --no-clean ` argument when you're building the cross-compile toolchain via ` make.bash `. - -#### Why does ` go get ` work for some packages and report ` permission denied ` in ` $GOROOT ` for some others (with GOPATH set properly)? -If you at any point installed the package in ` GOROOT ` (either by having no ` GOPATH ` set or by including ` GOROOT ` itself in ` GOPATH `) then there might still be a directory in ` $GOROOT ` (which is always checked first) that is overriding your ` GOPATH `. To verify, run ` go list -f {{.Dir}} importpath ` and if it reports a directory under ` $GOPATH ` try deleting that first. - -## Still need help? -Visit us on IRC or ask on the mailing list. You will want to provide the output of the following commands, in addition to any errors you are getting: - -### Linux/darwin - -``` -go version -go env -env | grep GO -``` - -### Windows - -``` -go version -go env -set | findstr GO -``` \ No newline at end of file diff --git a/InterfaceSlice.md b/InterfaceSlice.md index 51ad38f8..9dfe56d0 100644 --- a/InterfaceSlice.md +++ b/InterfaceSlice.md @@ -1,42 +1,4 @@ -# Introduction +The Go wiki on GitHub has moved to go.dev (#61940). -Given that you can assign a variable of any type to an ` interface{} `, often people will try code like the following. -```go -var dataSlice []int = foo() -var interfaceSlice []interface{} = dataSlice -``` -This gets the error -``` -cannot use dataSlice (type []int) as type []interface { } in assignment -``` +Try or . -The question then, "Why can't I assign any slice to an ` []interface{} `, when I can assign any type to an ` interface{} `?" - -## Why? - -There are two main reasons for this. - -The first is that a variable with type ` []interface{} ` is not an interface! It is a slice whose element type happens to be ` interface{} `. But even given this, one might say that the meaning is clear. - -Well, is it? A variable with type ` []interface{} ` has a specific memory layout, known at compile time. - -Each ` interface{} ` takes up two words (one word for the type of what is contained, the other word for either the contained data or a pointer to it). As a consequence, a slice with length N and with type ` []interface{} ` is backed by a chunk of data that is N\*2 words long. - -This is different than the chunk of data backing a slice with type ` []MyType ` and the same length. Its chunk of data will be N\*sizeof(MyType) words long. - -The result is that you cannot quickly assign something of type ` []MyType ` to something of type ` []interface{} `; the data behind them just look different. - -## What can I do instead? - -It depends on what you wanted to do in the first place. - -If you want a container for an arbitrary array type, and you plan on changing back to the original type before doing any indexing operations, you can just use an ` interface{} `. The code will be generic (if not compile-time type-safe) and fast. - -If you really want a ` []interface{} ` because you'll be doing indexing before converting back, or you are using a particular interface type and you want to use its methods, you will have to make a copy of the slice. -```go -var dataSlice []int = foo() -var interfaceSlice []interface{} = make([]interface{}, len(dataSlice)) -for i, d := range dataSlice { - interfaceSlice[i] = d -} -``` \ No newline at end of file diff --git a/InvalidFlag.md b/InvalidFlag.md index d7c14bed..4f56b848 100644 --- a/InvalidFlag.md +++ b/InvalidFlag.md @@ -1,23 +1,4 @@ -# `invalid flag in #cgo CFLAGS` +The Go wiki on GitHub has moved to go.dev (#61940). -This page describes the background for build errors like `invalid flag in #cgo CFLAGS` and what you can do about them. +Try or . -[CVE-2018-6574](https://nvd.nist.gov/vuln/detail/CVE-2018-6574) described a potential security violation in the go tool: running `go get` downloads and builds Go code from the Internet, Go code that uses cgo can specify options to pass to the compiler, so careful use of `-fplugin` can cause `go get` to execute arbitrary code. While it is difficult to block every possible way that the compiler might be attacked, we have chosen to block the obvious ones. - -As described at [issue 23672](https://go.dev/issue/23672), this is done by using a safelist of compiler/linker options that are permitted during `go get`, `go build`, and friends. When cgo code tries to use to pass an option that is not on the safelist, the go tool will report an error `invalid flag in #cgo CFLAGS` (or `#cgo LDFLAGS`, `pkg-config --cflags`, `pkg-config --ldflags`, and so forth). - -This safelist is new in releases 1.8.7, 1.9.4, and 1.10, and all subsequent releases. - -## What can I do? - -If this happens to you, and the option is benign, you should do two things: -1. Set the environment variable `CGO_CFLAGS_ALLOW` (or `CGO_LDFLAGS_ALLOW`, `CGO_CXXFLAGS_ALLOW`, and so forth) to a [regexp](https://pkg.go.dev/regexp/) that matches the option. -2. [File a bug](https://go.dev/issue/new) requesting that the option be added to the safelist. Be sure to include the complete error message and, if possible, a description of the code you are building. - -## Why not use an unsafe list? - -Because if some new unsafe option is added to a compiler, all existing Go releases will become immediately vulnerable. - -## Why not get a complete list of compiler options and safelist all of them? - -Because there are hundreds of options, and there is no clear way to get a complete list. Many compiler and linker options are target dependent, and thus only reported on specific platforms or in specific configurations. The documentation is known to be incomplete. \ No newline at end of file diff --git a/Iota.md b/Iota.md index baf343f7..b5e5a584 100644 --- a/Iota.md +++ b/Iota.md @@ -1,41 +1,4 @@ -# Summary +The Go wiki on GitHub has moved to go.dev (#61940). -Go's ` iota ` identifier is used in ` const ` declarations to simplify definitions of incrementing numbers. Because it can be used in expressions, it provides a generality beyond that of simple enumerations. +Try or . -The value of iota is reset to 0 whenever the reserved word ` const ` appears in the source (i.e. each const block) and incremented by one after each [ConstSpec](https://go.dev/ref/spec#ConstSpec) e.g. each Line. This can be combined with the constant shorthand (leaving out everything after the constant name) to very concisely define related constants. - -Iota: https://go.dev/ref/spec#Iota - -Constant declarations: https://go.dev/ref/spec#Constant_declarations - -# Examples - -The official spec has two great examples: - -https://go.dev/ref/spec#Iota - -Here's one from Effective Go: - -``` -type ByteSize float64 - -const ( - _ = iota // ignore first value by assigning to blank identifier - KB ByteSize = 1 << (10 * iota) - MB - GB - TB - PB - EB - ZB - YB -) -``` - -Weekday enum example - How iota is calculated - From [Learn Go Programming Blog](https://blog.learngoprogramming.com): - -![How iota works](https://cdn-images-1.medium.com/max/2000/1*sfAHT3zk-WjxSDRIDMpdaA.gif) - -# Articles - -* [Ultimate Visual Guide to Go Enums and Iota](https://blog.learngoprogramming.com/golang-const-type-enums-iota-bc4befd096d3) _2017-10-09_ \ No newline at end of file diff --git a/LUCI.md b/LUCI.md index 4d6181c1..1c742e42 100644 --- a/LUCI.md +++ b/LUCI.md @@ -1,33 +1,4 @@ -LUCI is the CI infrastructure for the Go project. The primary post-submit dashboard can be found at https://ci.chromium.org/p/golang. +The Go wiki on GitHub has moved to go.dev (#61940). -# TryBots +Try or . -Voting Commit-Queue+1 asks CQ to run the CL on the TryBots. -When the TryBots finish, CQ will reply with results, -voting either TryBot-Result+1 (pass) or TryBot-Result-1 (fail). -Important results (e.g. failures) will also appear as chips at the top -of the Gerrit page for the CL, under the commit message. - -![A red box indicating the location of the checks under the commit -message on the Gerrit page for an example CL.](https://github.com/golang/go/assets/1248668/93267ff3-11cd-41f7-b268-a5cc342cfcd3) - -More details about what was run are available at the "Checks" tab -on the Gerrit CL page. - -![A red arrow pointing to the location of the checks tab on the -Gerrit page for an example CL.](https://github.com/golang/go/assets/1248668/1a11fa8c-14cd-4b97-968c-6c52a8634c51) - -Every TryBot run includes a default set of the most common builders. -[SlowBots](https://go.dev/wiki/SlowBots) provide additional testing controls. - -# Troubleshooting - -## "infra failed" / purple failure - -Builders that fail with "infra failed" have a purple chip rather than green (passed) or red (tests failed). These failures indicate some kind of failure in the CI infrastructure itself. They are unlikely to be due to something in your CL. - -If you encounter such errors, you can reach out to [golang-dev](https://groups.google.com/g/golang-dev) for help investigating them. You may also try rerunning the build, which may succeed on a subsequent run depending on the cause of the infra failure. - -## build details - -The "Steps & Logs" section on a LUCI build page enumerates steps that were executed. Each step can be expanded to get to its logs, environment variables, and command line arguments. The "get go" step includes the output of `go env` from the Go toolchain used in the build. \ No newline at end of file diff --git a/Learn.md b/Learn.md index fa74727a..87273a34 100644 --- a/Learn.md +++ b/Learn.md @@ -1,53 +1,4 @@ -In addition to the resources available [at golang.org](https://go.dev/doc/#learning) there are a range of community-driven initiatives: +The Go wiki on GitHub has moved to go.dev (#61940). - * [Boot.dev's "Learn Go"](https://boot.dev/learn/learn-golang) - Code in the browser exercises with answer checking - * [Essential Go](https://www.programming-books.io/essential/go/) -- a free book about Go programming language. - * [Go in 5 Minutes](https://gifm.dev) - * [The Little Go Book](http://openmymind.net/The-Little-Go-Book/) - * [Tutorials Point](https://www.tutorialspoint.com/go/index.htm) - * [Exercism.io - Go](http://exercism.io/languages/go) - Online code exercises for Go for practice and mentorship. - * [EXLskills - A$AP Learn Go](https://exlskills.com/learn-en/courses/aap-learn-go-golang--learn_golang_asap) - Fast-paced free and open course for getting going with Go - * [Learn Go in an Hour - Video](https://www.youtube.com/watch?v=CF9S4QZuV30) _2015-02-15_ - * [Learning to Program in Go](https://www.youtube.com/playlist?list=PLei96ZX_m9sVSEXWwZi8uwd2vqCpEm4m6), a multi-part video training class. - * [Learn Go with Tests](https://quii.gitbook.io/learn-go-with-tests/) - An introduction to Go using a TDD approach. - * [Pluralsight Classes for Go](http://www.pluralsight.com/tag/golang) - A growing collection of (paid) online classes. - * [Ardan Labs Training](https://www.ardanlabs.com/) - Commercial, live instruction for Go programming. - * [O'Reilly Go Fundamentals](http://shop.oreilly.com/category/learning-path/go-fundamentals.do) - Video learning path for Go programming. - * [Go By Example](http://gobyexample.com/) provides a series of annotated code snippets. - * [Learn Go in Y minutes](http://learnxinyminutes.com/docs/go/) is a top-to-bottom walk-through of the language. - * [Workshop-Go](https://github.com/sendwithus/workshop-go) - Startup Slam Go Workshop - examples and slides. - * [Go Fragments](http://www.gofragments.net/) - A collection of annotated Go code examples. - * [50 Shades of Go: Traps, Gotchas, Common Mistakes for New Golang Devs](http://devs.cloudimmunity.com/gotchas-and-common-mistakes-in-go-golang/index.html) - * [Free Go Language Workshop](https://www.frameworktraining.co.uk/go-language-free-training-workshop/) Framework Training is running regular free BYOD workshops in London, UK - * [Golang Tutorials](http://golangtutorials.blogspot.com/2011/05/table-of-contents.html) - A free online class. - * Rob Pike's 2011 three day course - [Day 1](http://go.googlecode.com/hg-history/release-branch.r60/doc/GoCourseDay1.pdf), [Day 2](http://go.googlecode.com/hg-history/release-branch.r60/doc/GoCourseDay2.pdf), [Day 3](http://go.googlecode.com/hg-history/release-branch.r60/doc/GoCourseDay3.pdf) (*links are broken*, use the archived links from the wayback machine. [Day 1][wbday1], [Day 2][wbday2], [Day 3][wbday3]) - * [The Go Bridge Foundry](https://github.com/gobridge) - A member of the [Bridge Foundry](http://bridgefoundry.org/) family, offering a complete set of free Go training materials with the goal of bringing Go to under-served communities. -* [Golangbot](https://golangbot.com/learn-golang-series/) - Tutorials to get started with programming in Go. -* [Master Go](https://appliedgo.com/courses/mastergo/) - A paid online video course on Go for developers -* [Learn to Create Web Applications using Go](https://www.usegolang.com/) - A paid online video course and book about Web programming with Go -* [Learn Go Programming](https://blog.learngoprogramming.com) - Weekly visual and concise tutorials for programming in Go. -* [Gophercises](https://gophercises.com/) - coding exercises for budding gophers -* [Algorithms to Go](http://yourbasic.org/) - Texts about algorithms and Go, with plenty of code examples. -* [Games With Go](http://gameswithgo.org/) - Video series teaching programming fundamentals with game related projects. -* [Go Language Tutorials](https://www.cybrhome.com/topic/go-language-tutorials) - List of popular sites, blogs and tutorials for learning Go language. -* [Golang Development Video Course](https://www.youtube.com/playlist?list=PLzUGFf4GhXBL4GHXVcMMvzgtO8-WEJIoY) - A growing list of videos focused purely on Go development. -* [Go: The Complete Bootcamp Course](https://www.udemy.com/learn-go-the-complete-bootcamp-course-golang/?couponCode=GOWIKI) - Step by step and intuitive explanations for every aspect of Go using animations (Paid) -* [Learning Golang - TutorialEdge](https://tutorialedge.net/course/golang/) - A growing list of articles and courses on the fundamentals of Go. -* [Go Discourse](https://github.com/godiscourse/godiscourse) - Another forum base on Go, without framework and ORM. -* [دورة لغة غو بالعربي](https://argolang.com/learn-go-lang-beginners-course) -* [Apuntes de Golang en Español](https://apuntes.de/golang/) - Apuntes para aprender Go en Español desde Cero. -* [Go Classes at Codecademy](https://www.codecademy.com/learn/learn-go) - Online courses introducing the basics of Go. -* [Go Tutorial - W3Basic](https://www.w3basic.com/golang/) - A well organized and structured Golang Tutorials for Beginners and Professionals +Try or . -[wbday1]: http://web.archive.org/web/20160305024536/http://go.googlecode.com/hg-history/release-branch.r60/doc/GoCourseDay1.pdf -[wbday2]: http://web.archive.org/web/20160305081012/http://go.googlecode.com/hg-history/release-branch.r60/doc/GoCourseDay2.pdf -[wbday3]: http://web.archive.org/web/20160305075151/http://go.googlecode.com/hg-history/release-branch.r60/doc/GoCourseDay3.pdf - - -Learning resources for specific topics: - * [LearnConcurrency](LearnConcurrency) outlines a course of study of Go's concurrency model and patterns. - * [LearnErrorHandling](LearnErrorHandling) links to resources about error handling in Go. - * [LearnTesting](LearnTesting) links to resources about testing in Go. - * [LearnServerProgramming](LearnServerProgramming) links to resources about server programming in Go. - * [Golang Online Courses](https://classpert.com/go-programming) - A collection of Go online courses from several providers at Classpert - * [Hackr.io Golang Tutorials](https://hackr.io/tutorials/learn-golang) - Best Golang tutorials recommended by the programming community. \ No newline at end of file diff --git a/LearnConcurrency.md b/LearnConcurrency.md index 814d002d..2721fea7 100644 --- a/LearnConcurrency.md +++ b/LearnConcurrency.md @@ -1,47 +1,4 @@ -This page links to resources for learning about concurrency in Go. The items are presented in order, from beginner material to advanced topics. +The Go wiki on GitHub has moved to go.dev (#61940). -## Beginner -- Read [Effective Go: Concurrency](https://go.dev/doc/effective_go#concurrency) -- Watch [Simulating a real-world system in Go](https://www.dotconferences.com/2017/11/sameer-ajmani-simulating-a-real-world-system-in-go) -- Study [The Go Programming Language Specification](https://go.dev/ref/spec), especially - - [Go statements](https://go.dev/ref/spec#Go_statements) - - [Channel types](https://go.dev/ref/spec#Channel_types) - - [Send statements](https://go.dev/ref/spec#Send_statements) - - [Receive operator](https://go.dev/ref/spec#Receive_operator) - - [Select statements](https://go.dev/ref/spec#Select_statements) -- Code [A Tour of Go: Concurrency](http://tour.golang.org/concurrency/1) -- Read the [Frequently Asked Questions (FAQ)](https://go.dev/doc/faq), especially - - [Why build concurrency on the ideas of CSP?](https://go.dev/doc/faq#csp) - - [Why goroutines instead of threads?](https://go.dev/doc/faq#goroutines) - - [Why are map operations not defined to be atomic?](https://go.dev/doc/faq#atomic_maps) - - [What operations are atomic? What about mutexes?](https://go.dev/doc/faq#What_operations_are_atomic_What_about_mutexes) - - [Why doesn't my program run faster with more CPUs?](https://go.dev/doc/faq#parallel_slow) - - [How can I control the number of CPUs?](https://go.dev/doc/faq#number_cpus) - - [What happens with closures running as goroutines?](https://go.dev/doc/faq#closures_and_goroutines) +Try or . -## Intermediate -- Study [Go by Example](https://gobyexample.com) from [goroutines](https://gobyexample.com/goroutines) through [stateful goroutines](https://gobyexample.com/stateful-goroutines) -- Watch [Go Concurrency Patterns](https://talks.golang.org/2012/concurrency.slide#1) -- Watch [A Practical Guide to Preventing Deadlocks and Leaks in Go](https://www.youtube.com/watch?v=3EW1hZ8DVyw) -- Read [Share Memory By Communicating](https://go.dev/blog/share-memory-by-communicating) and do the [codewalk](https://go.dev/doc/codewalk/sharemem/) -- Read [Go Concurrency Patterns: Timing out, moving on](https://go.dev/blog/go-concurrency-patterns-timing-out-and) -- Watch [Concurrency is not Parallelism](http://talks.golang.org/2012/waza.slide#1) -- Read [Go Concurrency Patterns: Pipelines and Cancellation](https://go.dev/blog/pipelines) -- Read [Rethinking Classical Concurrency Patterns](https://github.com/golang/go/wiki/Go-Community-Slides#rethinking-classical-concurrency-patterns) -- Study [Package sync](https://pkg.go.dev/sync/) -- Read [Introducing the Go Race Detector](https://go.dev/blog/race-detector) -- Watch [Go: code that grows with grace](http://talks.golang.org/2012/chat.slide#1) -- Read [Mutexes and Semaphores Demystified](http://www.barrgroup.com/Embedded-Systems/How-To/RTOS-Mutex-Semaphore) - -## Advanced -- Watch [Advanced Go Concurrency Patterns](https://go.dev/blog/advanced-go-concurrency-patterns) -- Read [Advanced Go Concurrency Patterns](http://talks.golang.org/2013/advconc.slide#1) -- Read [Go Concurrency Patterns: Context](https://go.dev/blog/context) -- Study [The Go Memory Model](https://go.dev/ref/mem) -- Study [Package atomic](https://pkg.go.dev/sync/atomic/) -- Read [Principles of Designing Go APIs with Channels](https://inconshreveable.com/07-08-2014/principles-of-designing-go-apis-with-channels/) -- Read [Advanced Go Concurrency Primitives](https://encore.dev/blog/advanced-go-concurrency) -- Watch [The Scheduler Saga](https://www.youtube.com/watch?v=YHRO5WQGh0k) -- Read [The Scheduler Saga](https://speakerdeck.com/kavya719/the-scheduler-saga) -- Watch [Understanding Channels](https://www.youtube.com/watch?v=KBZlN0izeiY) -- Read [Understanding Channels](https://speakerdeck.com/kavya719/understanding-channels) \ No newline at end of file diff --git a/LearnErrorHandling.md b/LearnErrorHandling.md index d39a81b6..a0504d20 100644 --- a/LearnErrorHandling.md +++ b/LearnErrorHandling.md @@ -1,23 +1,4 @@ -This page links to resources about error handling in Go. +The Go wiki on GitHub has moved to go.dev (#61940). -## Getting Started +Try or . -- Read [Effective Go: Errors](https://go.dev/doc/effective_go#errors) -- Code [A Tour of Go: Errors](http://tour.golang.org/methods/19) and do the [exercise](http://tour.golang.org/methods/20) -- Study [The Go Programming Language Specification: Errors](https://go.dev/ref/spec#Errors) -- Study [Package errors](https://pkg.go.dev/errors/) -- Study [func fmt.Errorf](https://pkg.go.dev/fmt/#Errorf) - -## Standard Practice - -- Read [Why does Go not have exceptions?](https://go.dev/doc/faq#exceptions) -- Read [Error handling and Go](https://go.dev/blog/error-handling-and-go) -- Read [Go by Example: Errors](https://gobyexample.com/errors) -- Read [Errors are values](https://go.dev/blog/errors-are-values) -- Read [Working with Errors in Go 1.13](https://go.dev/blog/go1.13-errors) -- Read [golang/go/wiki: Errors](Errors) - -## Advanced Topics - -- Read [Why is my nil error value not equal to nil?](https://go.dev/doc/faq#nil_error) -- Read [Defer, Panic, and Recover](https://go.dev/blog/defer-panic-and-recover) \ No newline at end of file diff --git a/LearnServerProgramming.md b/LearnServerProgramming.md index 8172e0a5..5c502e21 100644 --- a/LearnServerProgramming.md +++ b/LearnServerProgramming.md @@ -1,124 +1,4 @@ -This page links to resources for learning about server programming in Go - both web services and mobile backends. The items are organized into sections by topic. +The Go wiki on GitHub has moved to go.dev (#61940). -## Getting Started +Try or . -- Read [Writing Web Applications with the Go standard library](https://go.dev/doc/articles/wiki/) -- Read [Build a Web Application With Go](https://astaxie.gitbooks.io/build-web-application-with-golang/content/) from the author of the [BeeGo web framework][beego] -- Read [Webapps in Go the anti textbook](https://github.com/thewhitetulip/web-dev-golang-anti-textbook) -- Read [Building Web Applications in Go](https://codegangsta.gitbooks.io/building-web-apps-with-go/content/) from the author of the [Negroni](https://github.com/codegangsta/negroni) and [Martini](http://martini.codegangsta.io/) webserver toolkits. First learn the absolute basics before going to this book. -- Read [Building Your Own Web Framework in Go](https://www.nicolasmerouze.com/build-web-framework-golang/) a 5-part series. -- Watch [Go: code that grows with grace](http://talks.golang.org/2012/chat.slide#1) -- Download a [full working 3-tier application example](https://github.com/sourcegraph/thesrc) from the Sourcegraph Team. - -### Middleware - -A topic you will see discussed frequently is "middleware". If you're not familiar with that term, we suggest you start out by reading a few of these articles: - -* [Middleware in Go: Best practices and examples](https://www.nicolasmerouze.com/middlewares-golang-best-practices-examples/) _2014-11-13_ -* Custom Handlers [Part 1 - Avoiding Globals](http://elithrar.github.io/article/custom-handlers-avoiding-globals/), [Part 2 - Error Handling](http://elithrar.github.io/article/http-handler-error-handling-revisited/) _2014-07-16_ -* [Making and Using HTTP Middleware](http://www.alexedwards.net/blog/making-and-using-middleware) _2014-10-21_ -* [Writing HTTP Middleware in Go](https://justinas.org/writing-http-middleware-in-go/) _2013-10-09_ - - -## Toolkits and Frameworks - -Before you decide to adopt a third party web framework or toolkit, keep in mind that the Go standard library provides all of the tools you need to build a sophisticated, modern web application. Keeping with Go's preference for simplicity and composability over complexity and magic, we suggest you [see how far the standard library can take you](https://go.dev/doc/articles/wiki/). - -If you decide you need a bit more infrastructure, start by looking at some of the toolkits and libraries available. - -### Toolkits & Libraries & Microframeworks - -* [Gorilla Toolkit](http://www.gorillatoolkit.org/) -* [Negroni Toolkit - Idiomatic HTTP Middleware for Go](https://github.com/codegangsta/negroni) -* [Echo Framework - Fast and Unfancy](http://echo.labstack.com/) -* [Goji Web Microframework](https://goji.io/) -* [Go Craft Middleware](https://github.com/gocraft/web) -* [Go RESTful](https://github.com/emicklei/go-restful) - Toolkit for RESTful service APIs -* [limiter](https://github.com/ulule/limiter) - Simple rate-limiting middleware for Go -* [Kite Micro-service framework](https://github.com/koding/kite) -* [Alice - Painless middleware chaining for Go](https://github.com/justinas/alice) -* [YAM - Yet Another Mux](https://github.com/thisissoon/yam) -* [Bone - Fast HTTP Router](http://go-zoo.github.io/bone/) - -### Frameworks - -* [BeeGo Framework][beego] -* [Frodo](https://github.com/kn9ts/frodo) - Go mini web framework inspired by Laravel(php), Slim(php) and ExpressJS(node.js) -* [GinGonic](https://gin-gonic.com/) -* [Macaron](https://github.com/Unknwon/macaron) - Productive, modular web framework in Go. -* [Revel Web Framework](https://revel.github.io/) -* [Ringo](https://github.com/jjyr/ringo) - Lightweight MVC web framework inspired by Rails, Gin. -* [Utron](https://github.com/gernest/utron) - Lightweight MVC framework for web applications. -* [Iris](https://github.com/kataras/iris/) - Fast MVC framework for web applications. - -## Communication - -- [Package net/http](https://pkg.go.dev/net/http) provides HTTP client and server implementations. -- [Package encoding/json](https://pkg.go.dev/encoding/json) implements encoding and decoding of JSON objects as defined in RFC 4627. -- [Package net/rpc](https://pkg.go.dev/net/rpc) provides access to the exported methods of an object across a network or other I/O connection. -- [Package os/exec](https://pkg.go.dev/os/exec) runs external commands. - -## Presentation - -- [Package text/template](https://pkg.go.dev/text/template) implements data-driven templates for generating textual output. -- [Package html/template](https://pkg.go.dev/html/template) implements data-driven templates for generating HTML output safe against code injection. - -## Profiling and Performance - -- Read [Profiling Go Programs](https://go.dev/blog/profiling-go-programs) -- Read [Arrays, slices (and strings): The mechanics of 'append'](https://go.dev/blog/slices) -- Read the [Frequently Asked Questions (FAQ)](https://go.dev/doc/faq), especially - - [Why does Go perform badly on benchmark X?](https://go.dev/doc/faq#Why_does_Go_perform_badly_on_benchmark_x) - - [Why do garbage collection? Won't it be too expensive?](https://go.dev/doc/faq#garbage_collection) -- [Package bufio](https://pkg.go.dev/bufio) implements buffered I/O. -- [Package runtime/pprof](https://pkg.go.dev/runtime/pprof) writes runtime profiling data in the format expected by the pprof visualization tool. -- [Package net/http/pprof](https://pkg.go.dev/net/http/pprof) serves via its HTTP server runtime profiling data in the format expected by the pprof visualization tool. - -## Tracing, Monitoring, Logging, and Configuration - -- [Package expvar](https://pkg.go.dev/expvar) provides a standardized interface to public variables, such as operation counters in servers. -- [Package flag](https://pkg.go.dev/flag) implements command-line flag parsing. -- [Package log](https://pkg.go.dev/log) implements a simple logging package. -- [Package glog](https://github.com/golang/glog) implements logging analogous to the Google-internal C++ INFO/ERROR/V setup. - -## Storage - -- [Package os](https://pkg.go.dev/os) provides a platform-independent interface to operating system functionality. -- [Package path/filepath](https://pkg.go.dev/path/filepath) implements utility routines for manipulating filename paths in a way compatible with the target operating system-defined file paths. -- [Package database/sql](https://pkg.go.dev/database/sql) provides a generic interface around SQL (or SQL-like) databases. - -## Platforms - -### Google Cloud Platform - -- Read [Go, Cloud Endpoints and App Engine, Part 1](https://medium.com/google-cloud/go-cloud-endpoints-and-app-engine-19d290dafda3), [Part 2](https://medium.com/@IndianGuru/go-cloud-endpoints-and-app-engine-e3413c01c484) -- Read [Google Cloud Platform: Go Runtime Environment](https://cloud.google.com/appengine/docs/go/) -- Watch [Go and the Google Cloud Platform](https://go.dev/blog/go-and-google-cloud-platform) -- Read [Go on App Engine: tools, tests, and concurrency](https://go.dev/blog/appengine-dec2013) -- Get [Google Cloud Platform Go Libraries](https://pkg.go.dev/google.golang.org/cloud) -- Read [Deploying Go servers with Docker](https://go.dev/blog/docker) -- Search packages for [Google Cloud](https://pkg.go.dev/search?q=google+cloud) or [gcloud](https://pkg.go.dev/search?q=gcloud) -- Search packages for [App Engine](https://pkg.go.dev/search?q=appengine) or [GAE](https://pkg.go.dev/search?q=gae) - -### Amazon Web Services - -- The [aws-sdk-go](https://github.com/aws/aws-sdk-go) repository provides automatically generated AWS clients in Go. It has [official support](https://aws.amazon.com/blogs/aws/now-available-version-1-0-of-the-aws-sdk-for-go/) from Amazon. -- [Package goamz](https://wiki.ubuntu.com/goamz) enables Go programs to interact with the Amazon Web Services. -- Search packages for [AWS](https://pkg.go.dev/search?q=aws) or [Amazon services](https://pkg.go.dev/search?q=amazon+service) - -### Microsoft Azure - -- Microsoft OpenTech's [azure-sdk-for-go](https://github.com/MSOpenTech/azure-sdk-for-go) provides a Golang package that makes it easy to consume and manage Microsoft Azure Services. -- Search packages for [Azure](http://pkg.go.dev/search?q=azure) - -### Openstack / Rackspace - -- [Gophercloud](https://github.com/gophercloud/gophercloud) is a Golang SDK for working with OpenStack clouds. -- Search packages for [Openstack](https://pkg.go.dev/search?q=openstack) or [Rackspace](https://pkg.go.dev/search?q=rackspace) - -### IBM BlueMix - -- [Write your first Golang app on BlueMix](https://developer.ibm.com/bluemix/2015/10/28/getting-started-with-golang-on-bluemix/) - - - [beego]: https://github.com/beego/beego \ No newline at end of file diff --git a/LearnTesting.md b/LearnTesting.md index ca6cfecc..c4d738d2 100644 --- a/LearnTesting.md +++ b/LearnTesting.md @@ -1,9 +1,4 @@ -This page links to resources about testing in Go. +The Go wiki on GitHub has moved to go.dev (#61940). + +Try or . -- Read [How to Write Go Code](https://go.dev/doc/code), especially [Testing](https://go.dev/doc/code#Testing) -- Study [Package testing](https://pkg.go.dev/testing) -- Read [Why does Go not have assertions?](https://go.dev/doc/faq#assertions) -- Read [Where is my favorite helper function for testing?](https://go.dev/doc/faq#testing_framework) -- Watch [Testing Techniques](https://talks.golang.org/2014/testing.slide#1) -- Read [TableDrivenTests](TableDrivenTests) -- Read [Using Subtests and Sub-benchmarks](https://go.dev/blog/subtests) \ No newline at end of file diff --git a/Linux.md b/Linux.md index a60d7ec9..71d781e0 100644 --- a/Linux.md +++ b/Linux.md @@ -1,13 +1,4 @@ -# Go on Linux +The Go wiki on GitHub has moved to go.dev (#61940). -| **Kernel version** | **Architectures** | **Initial support version** | **Final support version** | -|:-------------------|:----------------------|:----------------------------|:--------------------------| -| TBD | mips, mipsle | Go 1.8 | | -| TBD | s390x | Go 1.7 | | -| 4.8 or above | mips64le | Go 1.6 | | -| TBD | mips64 | Go 1.6 | | -| TBD | arm64, ppc64, ppc64le | Go 1.5 | | -| 3.1 or above | arm | Go 1.1 _*_ | | -| 2.6.23 or above | amd64, 386 | Go 1 _*_ | | +Try or . -_*_ Go 1.5 or above is recommended. \ No newline at end of file diff --git a/LinuxKernelSignalVectorBug.md b/LinuxKernelSignalVectorBug.md index 9a2e7f58..6dbb58c1 100644 --- a/LinuxKernelSignalVectorBug.md +++ b/LinuxKernelSignalVectorBug.md @@ -1,263 +1,4 @@ -# Introduction +The Go wiki on GitHub has moved to go.dev (#61940). -If you reached this page because of a message like this printed by a Go program: +Try or . -``` -runtime: note: your Linux kernel may be buggy -runtime: note: see https://go.dev/wiki/LinuxKernelSignalVectorBug -runtime: note: mlock workaround for kernel bug failed with errno -``` - -then you are using a Linux kernel that may have a bug. -This kernel bug may have caused memory corruption in your Go program, and may have caused your Go program to crash. - -If you understand why your program crashed, then you can ignore this page. - -Otherwise, this page will explain what the kernel bug is, and includes a C program that you can use to check whether your kernel has the bug. - -# Bug description - -A bug was introduced in Linux kernel version 5.2: if a signal is delivered to a thread, and delivering the signal requires faulting in pages of the thread signal stack, then AVX YMM registers may be corrupted upon returning from the signal to the program. -If the program was executing some function that uses the YMM registers, that function can behave unpredictably. - -The bug only happens on systems with an x86 processor. -The bug affects programs written in any language. -The bug only affects programs that receive signals. -Among programs that receive signals, the bug is more likely to affect programs that use an alternate signal stack. -The bug only affects programs that use the YMM registers. -In Go programs in particular the bug will normally cause memory corruption, as Go programs primarily use the YMM registers to implement copying one memory buffer to another. - -The bug [was reported to the Linux kernel developers](https://bugzilla.kernel.org/show_bug.cgi?id=205663). -It was quickly fixed. -The bug fix was not ported back to the Linux kernel 5.2 series. -The bug was fixed in Linux kernel versions 5.3.15, 5.4.2, and 5.5 and later. - -The bug is only present if the kernel was compiled with GCC 9 or later. - -The bug is present in vanilla Linux kernel versions 5.2.x for any x, 5.3.0 through 5.3.14, and 5.4.0 and 5.4.1. -However, many distros that are shipping those kernel versions have in fact backported the patch (which is very small). -And, some distros are still compiling their kernel with GCC 8, in which case the kernel does not have the bug. - -In other words, even if your kernel is in the vulnerable range, there is a good chance that it is not vulnerable to the bug. - -# Bug test - -To test whether your kernel has the bug, you can run the following C program (click on "Details" to see the program). -On a buggy kernel, it will fail almost immediately. -On a kernel without the bug, it will run for 60 seconds and then exit with a 0 status. - -
    - -```C -// Build with: gcc -pthread test.c -// -// This demonstrates an issue where AVX state becomes corrupted when a -// signal is delivered where the signal stack pages aren't faulted in. -// -// There appear to be three necessary ingredients, which are marked -// with "!!!" below: -// -// 1. A thread doing AVX operations using YMM registers. -// -// 2. A signal where the kernel must fault in stack pages to write the -// signal context. -// -// 3. Context switches. Having a single task isn't sufficient. - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static int sigs; - -static stack_t altstack; -static pthread_t tid; - -static void die(const char* msg, int err) { - if (err != 0) { - fprintf(stderr, "%s: %s\n", msg, strerror(err)); - } else { - fprintf(stderr, "%s\n", msg); - } - exit(EXIT_FAILURE); -} - -void handler(int sig __attribute__((unused)), - siginfo_t* info __attribute__((unused)), - void* context __attribute__((unused))) { - sigs++; -} - -void* sender(void *arg) { - int err; - - for (;;) { - usleep(100); - err = pthread_kill(tid, SIGWINCH); - if (err != 0) - die("pthread_kill", err); - } - return NULL; -} - -void dump(const char *label, unsigned char *data) { - printf("%s =", label); - for (int i = 0; i < 32; i++) - printf(" %02x", data[i]); - printf("\n"); -} - -void doAVX(void) { - unsigned char input[32]; - unsigned char output[32]; - - // Set input to a known pattern. - for (int i = 0; i < sizeof input; i++) - input[i] = i; - // Mix our PID in so we detect cross-process leakage, though this - // doesn't appear to be what's happening. - pid_t pid = getpid(); - memcpy(input, &pid, sizeof pid); - - while (1) { - for (int i = 0; i < 1000; i++) { - // !!! Do some computation we can check using YMM registers. - asm volatile( - "vmovdqu %1, %%ymm0;" - "vmovdqa %%ymm0, %%ymm1;" - "vmovdqa %%ymm1, %%ymm2;" - "vmovdqa %%ymm2, %%ymm3;" - "vmovdqu %%ymm3, %0;" - : "=m" (output) - : "m" (input) - : "memory", "ymm0", "ymm1", "ymm2", "ymm3"); - // Check that input == output. - if (memcmp(input, output, sizeof input) != 0) { - dump("input ", input); - dump("output", output); - die("mismatch", 0); - } - } - - // !!! Release the pages of the signal stack. This is necessary - // because the error happens when copy_fpstate_to_sigframe enters - // the failure path that handles faulting in the stack pages. - // (mmap with MMAP_FIXED also works.) - // - // (We do this here to ensure it doesn't race with the signal - // itself.) - if (madvise(altstack.ss_sp, altstack.ss_size, MADV_DONTNEED) != 0) - die("madvise", errno); - } -} - -void doTest() { - // Create an alternate signal stack so we can release its pages. - void *altSigstack = mmap(NULL, SIGSTKSZ, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); - if (altSigstack == MAP_FAILED) - die("mmap failed", errno); - altstack.ss_sp = altSigstack; - altstack.ss_size = SIGSTKSZ; - if (sigaltstack(&altstack, NULL) < 0) - die("sigaltstack", errno); - - // Install SIGWINCH handler. - struct sigaction sa = { - .sa_sigaction = handler, - .sa_flags = SA_ONSTACK | SA_RESTART, - }; - sigfillset(&sa.sa_mask); - if (sigaction(SIGWINCH, &sa, NULL) < 0) - die("sigaction", errno); - - // Start thread to send SIGWINCH. - int err; - pthread_t ctid; - tid = pthread_self(); - if ((err = pthread_create(&ctid, NULL, sender, NULL)) != 0) - die("pthread_create sender", err); - - // Run test. - doAVX(); -} - -void *exiter(void *arg) { - sleep(60); - exit(0); -} - -int main() { - int err; - pthread_t ctid; - - // !!! We need several processes to cause context switches. Threads - // probably also work. I don't know if the other tasks also need to - // be doing AVX operations, but here we do. - int nproc = sysconf(_SC_NPROCESSORS_ONLN); - for (int i = 0; i < 2 * nproc; i++) { - pid_t child = fork(); - if (child < 0) { - die("fork failed", errno); - } else if (child == 0) { - // Exit if the parent dies. - prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); - doTest(); - } - } - - // Exit after a while. - if ((err = pthread_create(&ctid, NULL, exiter, NULL)) != 0) - die("pthread_create exiter", err); - - // Wait for a failure. - int status; - if (wait(&status) < 0) - die("wait", errno); - if (status == 0) - die("child unexpectedly exited with success", 0); - fprintf(stderr, "child process failed\n"); - exit(1); -} -``` - -
    - -# What to do - -If your kernel version is in the range that may contain the bug, run the C program above to see if it fails. -If it fails, your kernel is buggy. -You should upgrade to a newer kernel. -There is no workaround for this bug. - -Go programs built with 1.14 will attempt to mitigate the bug by using the `mlock` system call to lock the signal stack page into memory. -This works because the bug only occurs if the signal stack page has to be faulted in. -However, this use of `mlock` can fail. -If you see the message - -``` -runtime: note: mlock workaround for kernel bug failed with errno 12 -``` - -the `errno 12` (also known as `ENOMEM`) means that `mlock` failed because the system set a limit on the amount of memory that a program can lock. -If you can increase the limit, the program may succeed. -This is done using `ulimit -l`. -When running a program in a docker container, you can increase the limit by invoking docker with the option `-ulimit memlock=67108864`. - -If you cannot increase the `mlock` limit, then you can make the bug less likely to interfere with your program by setting the environment variable `GODEBUG=asyncpreemptoff=1` when running a Go program. -However, this just makes your program less likely to suffer memory corruption (because it reduces the number of signals that your program will receive). -The bug is still present, and memory corruption may still occur. - -# Questions? - -Ask on the mailing list golang-nuts@googlegroups.com, or on any Go forum as described at [Questions](https://go.dev/wiki/Questions). - -# Details - -To see more details on how the bug affects Go programs and how it was detected and understood, see [#35777](https://go.dev/issue/35777) and [#35326](https://go.dev/issue/35326). \ No newline at end of file diff --git a/Livestreams.md b/Livestreams.md index 1c730930..f0ce31e9 100644 --- a/Livestreams.md +++ b/Livestreams.md @@ -1,29 +1,4 @@ -This table attempts to collect all known regular livestreams centered around Go. Please keep each table sorted alphabetically by name. +The Go wiki on GitHub has moved to go.dev (#61940). -Note that conferences and podcasts have their own wiki pages already, and should not be included here. Similarly, meetups are already collected [here](https://www.meetup.com/topics/go/). - -### In English - -| Name | Topic (short) | Frequency | Link | -|--------------------|---------------------------------|----------------------|------| -| Ashley Jeffs | Working on Benthos and OSS | Twice per week | https://www.youtube.com/c/Jeffail | -| Chewxy | Hacking around. Usually machine learning / deep neural networks related | Weekly | https://www.youtube.com/chewxy | -| Jordan Lewis | CockroachDB internals | Twice per week | https://www.twitch.tv/large__data__bank | -| Matt Layher | Linux networking/syscalls in Go | Twice per month | https://www.twitch.tv/mdlayher | -| Matthew Dempsky | Hacking on the Go compiler | Three times per week | https://www.twitch.tv/mdempsky | -| Michael Stapelberg | Hacking on OSS projects | Aiming for 1x/month | https://www.twitch.tv/stapelberg | -| Travis Jeffery | Distributed systems and data streaming | Twice a month | https://www.twitch.tv/travisjeffery | - -### In Russian - -| Name | Topic (short) | Frequency | Link | -|--------------------|---------------------------------|----------------------|------| -| Good reviewer - Bad reviewer | Code review and commentary for open source projects | Weekly | [YouTube](https://www.youtube.com/channel/UC8_A5W8g7UV0pk0uL66iQAQ) | -| Generic Talks | Podcast about Go and systems programming | Weekly | [YouTube](https://www.youtube.com/channel/UCLW_8skJ-sIHXACL7HZqchA) | - -### In Chinese - -| Name | Topic (short) | Frequency | Link | -|--------------------|---------------------------------|----------------------|------| -| Go 夜读 - TalkGo | Weekly Go Online Meetup | Weekly | [YouTube](https://www.youtube.com/c/talkgo_night), [Bilibili](https://space.bilibili.com/326749661), [GitHub](https://github.com/talkgo/night) | +Try or . diff --git a/LockOSThread.md b/LockOSThread.md index 264b5a5d..fc1142b0 100644 --- a/LockOSThread.md +++ b/LockOSThread.md @@ -1,49 +1,4 @@ -# Introduction +The Go wiki on GitHub has moved to go.dev (#61940). -Some libraries—especially graphical frameworks and libraries like Cocoa, OpenGL, and libSDL—use thread-local state and can require functions to be called only from a specific OS thread, typically the 'main' thread. Go provides the `runtime.LockOSThread` function for this, but it's notoriously difficult to use correctly. +Try or . -# Solutions - -Russ Cox presented a good solution for this problem in this [thread](https://groups.google.com/d/msg/golang-nuts/IiWZ2hUuLDA/SNKYYZBelsYJ). - -```Go -package sdl - -// Arrange that main.main runs on main thread. -func init() { - runtime.LockOSThread() -} - -// Main runs the main SDL service loop. -// The binary's main.main must call sdl.Main() to run this loop. -// Main does not return. If the binary needs to do other work, it -// must do it in separate goroutines. -func Main() { - for f := range mainfunc { - f() - } -} - -// queue of work to run in main thread. -var mainfunc = make(chan func()) - -// do runs f on the main thread. -func do(f func()) { - done := make(chan bool, 1) - mainfunc <- func() { - f() - done <- true - } - <-done -} -``` - -And then other functions you write in package sdl can be like - -```Go -func Beep() { - do(func() { - // whatever must run in main thread - }) -} -``` \ No newline at end of file diff --git a/LoopvarExperiment.md b/LoopvarExperiment.md index 738332ae..47661d94 100644 --- a/LoopvarExperiment.md +++ b/LoopvarExperiment.md @@ -1,228 +1,4 @@ -For Go 1.22, the Go team is considering changing the semantics of for loop variables to prevent unintended sharing in per-iteration closures and goroutines. Go 1.21 contains a preliminary implementation of the change, enabled by setting `GOEXPERIMENT=loopvar` when building your program. We invite anyone who wants to help us understand the effects of the change to try using `GOEXPERIMENT=loopvar` and let us know about any problems or successes encountered. +The Go wiki on GitHub has moved to go.dev (#61940). -This page answers frequently asked questions about the change. +Try or . -## How do I try the change? - -Using Go 1.21, build your program using `GOEXPERIMENT=loopvar`, as in - - GOEXPERIMENT=loopvar go install my/program - GOEXPERIMENT=loopvar go build my/program - GOEXPERIMENT=loopvar go test my/program - GOEXPERIMENT=loopvar go test my/program -bench=. - ... - -## What is the problem this solves? - -Consider a loop like: - -```go - func TestAllEvenBuggy(t *testing.T) { - testCases := []int{1, 2, 4, 6} - for _, v := range testCases { - t.Run("sub", func(t *testing.T) { - t.Parallel() - if v&1 != 0 { - t.Fatal("odd v", v) - } - }) - } - } -``` - -This test aims to check that all the test cases are even (they are not!), but it passes without `GOEXPERIMENT=loopvar`. The problem is that t.Parallel stops the closure and lets the loop continue, and then it runs all the closures in parallel when `TestAllEvenBuggy` returns. By the time the if statement in the closure executes, the loop is done, and v has its final iteration value, 6. All four subtests now continue executing in parallel, and they all check that 6 is even, instead of checking each of the test cases. - -Another variant of this problem is - -```go - func TestAllEven(t *testing.T) { - testCases := []int{0, 2, 4, 6} - for _, v := range testCases { - t.Run("sub", func(t *testing.T) { - t.Parallel() - if v&1 != 0 { - t.Fatal("odd v", v) - } - }) - } - } -``` - -This test is not incorrectly passing, since 0, 2, 4, and 6 are all even, but it is also not testing whether it handles 0, 2, and 4 correctly. Like `TestAllEvenBuggy`, it tests 6 four times. - -Another less common but still frequent form of this bug is capturing the loop variable in a 3-clause for loop: - -```go - func Print123() { - var prints []func() - for i := 1; i <= 3; i++ { - prints = append(prints, func() { fmt.Println(i) }) - } - for _, print := range prints { - print() - } - } -``` - -This program looks like it will print 1, 2, 3, but in fact prints 4, 4, 4. - -This kind of unintended sharing bug hits all Go programmers, whether they are just starting to learn Go or have been using it for a decade. Discussion of this problem is one of the [earliest entries in the Go FAQ](https://go.dev/doc/faq#closures_and_goroutines). - -Here is a [public example of a production problem caused by this kind of bug](https://bugzilla.mozilla.org/show_bug.cgi?id=1619047), from Let's Encrypt. The code in question said: - -```go -// authz2ModelMapToPB converts a mapping of domain name to authz2Models into a -// protobuf authorizations map -func authz2ModelMapToPB(m map[string]authz2Model) (*sapb.Authorizations, error) { - resp := &sapb.Authorizations{} - for k, v := range m { - // Make a copy of k because it will be reassigned with each loop. - kCopy := k - authzPB, err := modelToAuthzPB(&v) - if err != nil { - return nil, err - } - resp.Authz = append(resp.Authz, &sapb.Authorizations_MapElement{Domain: &kCopy, Authz: authzPB}) - } - return resp, nil -} -``` - -Note the `kCopy := k` guarding against the `&kCopy` used at the end of the loop body. Unfortunately, it turns out that `modelToAuthzPB` kept a pointer to a couple fields in `v`, which is impossible to know when reading this loop. - -The initial impact of this bug was that Let's Encrypt needed to [revoke over 3 million improperly-issued certificates](https://community.letsencrypt.org/t/revoking-certain-certificates-on-march-4/114864). They ended up not doing that because of the negative impact it would have had on internet security, instead [arguing for an exception](https://bugzilla.mozilla.org/show_bug.cgi?id=1619179), but that gives you a sense of the kind of impact. - -The code in question was carefully reviewed when written, and the author was clearly aware of the potential problem, since they wrote `kCopy := k`, and yet it _still had a major bug_, one that is not visible unless you also know exactly what `modelToAuthzPB` does. - -## What is the proposed solution? - -The solution is to make loop variables declared in for loops using `:=` be a different instance of the variable on each iteration. This way, if the value is captured in a closure or goroutine or otherwise outlasts the iteration, later references to it will see the value it had during that iteration, not a value overwritten by a later iteration. - -For range loops, the effect is as if each loop body starts with `k := k` and `v := v` for each range variable. -In the Let's Encrypt example above, the `kCopy := k` would not be necessary, and the bug caused by not having `v := v` -would have been avoided. - -For 3-clause for loops, the effect is as if each loop body starts with `i := i` and then the reverse assignment -happens at the end of the loop body, copying the per-iteration `i` back out to the `i` that will be used to -prepare for the next iteration. This sounds complex, but in practice all common for loop idioms continue -to work exactly as they always have. The only time the loop behavior changes is when `i` is captured and shared -with something else. For example, this code runs as it always has: - -```go - for i := 0;; i++ { - if i >= len(s) || s[i] == '"' { - return s[:i] - } - if s[i] == '\\' { // skip escaped char, potentially a quote - i++ - } - } -``` - -For full details, see [the design document](https://go.googlesource.com/proposal/+/master/design/60078-loopvar.md). - -## Can this change break programs? - -Yes, it is possible to write programs that this change would break. For example, here is a surprising way to add the values in a list using a single-element map: - -```go -func sum(list []int) int { - m := make(map[*int]int) - for _, x := range list { - m[&x] += x - } - for _, sum := range m { - return sum - } - return 0 -} -``` - -It depends on the fact that there is only one `x` in the loop, so that `&x` is the same in each iteration. With `GOEXPERIMENT=loopvar`, `x` escapes the iteration, so `&x` is different on each iteration, and the map now has multiple entries instead of a single entry. - -And here is a surprising way to print the values 0 through 9: - -```go - var f func() - for i := 0; i < 10; i++ { - if i == 0 { - f = func() { print(i) } - } - f() - } -``` - -It depends on the fact that the `f` initialized on the first iteration “sees” the new value of `i` each time it is called. With `GOEXPERIMENT=loopvar`, it prints 0 ten times. - -Although it is possible to construct artificial programs that break using `GOEXPERIMENT=loopvar`, we have yet to see any real programs -that execute incorrectly. - -C# made a similar change in C# 5.0 and [they also reported](https://github.com/golang/go/discussions/56010#discussioncomment-3788526) having very few problems caused by the change. - -More breaking or surprising cases are shown in [here](https://github.com/golang/go/issues/60078#issuecomment-1544324607) and [here](https://github.com/golang/go/issues/60078#issuecomment-1546019456). - -## How often does the change break real programs? - -Empirically, almost never. Testing on Google's codebase found many tests were fixed. It also identified some buggy tests incorrectly passing due to bad interactions between loop variables and `t.Parallel`, like in `TestAllEvenBuggy` above. We rewrote those tests to correct them. - -Our experience suggests that the new semantics fixes buggy code far more often than it breaks correct code. The new semantics only caused test failures in about 1 of every 8,000 test packages (all of them incorrectly passing tests), but running the updated Go 1.20 `loopclosure` vet check over our entire code base flagged tests at a much higher rate: 1 in 400 (20 in 8,000). The `loopclosure` checker has no false positives: all the reports are buggy uses of `t.Parallel` in our source tree. That is, about 5% of the flagged tests were like `TestAllEvenBuggy`; the other 95% were like `TestAllEven`: not (yet) testing what it intended, but a correct test of correct code even with the loop variable bug fixed. - -Google has been running with the new loop semantics applied to all for loops in the standard production toolchain since early May 2023 with not a single reported problem (and many cheers). - -For more details about our experience at Google, see [this writeup](https://go.googlesource.com/proposal/+/master/design/60078-loopvar.md#fixes). - -We also [tried the new loop semantics in Kubernetes](https://github.com/golang/go/issues/60078#issuecomment-1556058025). It identified two newly failing tests due to latent loop variable scoping-related bugs in the underlying code. For comparison, updating Kubernetes from Go 1.20 to Go 1.21 identified three newly failing tests due to reliance on undocumented behaviors in Go itself. The two tests failing due to loop variable changes are not a significant new burden compared to an ordinary release update. - -## Will the change make programs slower by causing more allocations? - -The vast majority of loops are unaffected. A loop only compiles differently if the loop variable has its address taken (`&i`) or is captured by a closure. - -Even for affected loops, the compiler's escape analysis may determine that the loop variable can still be stack-allocated, meaning no new allocations. - -However, in some cases, an extra allocation will be added. Sometimes, the extra allocation is inherent to fixing a latent bug. For example, Print123 is now allocating three separate ints (inside the closures, it turns out) instead of one, which is necessary to print the three different values after the loop finishes. In rare other cases, the loop may be correct with a shared variable and still correct with separate variables but is now allocating N different variables instead of one. In very hot loops, this might cause slowdowns. Such problems should be obvious in memory allocation profiles (using `pprof --alloc_objects`). - -Benchmarking of the public “bent” bench suite showed no statistically significant performance difference over all, and we've observed no performance problems in Google's internal production use either. We expect most programs to be unaffected. - -## If the proposal is accepted, how will the change be deployed? - -Consistent with Go's general [approach to compatibility](https://tip.golang.org/doc/godebug), the new for loop semantics will only apply when the package being compiled is from a module that contains a `go` line declaring Go 1.22 or later, like `go 1.22` or `go 1.23`. This conservative approach ensures that _no programs will change behavior due to simply adopting the new Go toolchain_. Instead, each module author controls when their module changes to the new semantics. - -The `GOEXPERIMENT=loopvar` trial mechanism does not use the declared Go language version: it applies the new semantics to every for loop in the program unconditionally. This gives a worst case behavior to help identify the maximum possible impact of the change. - -## Can I see a list of places in my code affected by the change? - -Yes. You can build with `-gcflags=all=-d=loopvar=2` on the command line. That will print a warning-style output line for every loop that is compiling differently, like: - - $ go build -gcflags=all=-d=loopvar=2 cmd/go - ... - modload/import.go:676:7: loop variable d now per-iteration, stack-allocated - modload/query.go:742:10: loop variable r now per-iteration, heap-allocated - -The `all=` prints about changes to all packages in your build. If you omit the `all=`, as in `-gcflags=-d=loopvar=2`, only the -packages you name on the command line (or the package in the current directory) will emit the diagnostic. - -## My test fails with the change. How can I debug it? - -A new tool called `bisect` enables the change on different subsets of a program to identify which specific loops trigger a test failure when compiled with the change. If you have a failing test, `bisect` will identify the specific loop that is causing the problem. Use: - - go install golang.org/x/tools/cmd/bisect@latest - bisect -compile=loopvar go test - -See the [bisect transcript section of this comment](https://github.com/golang/go/issues/60078#issuecomment-1556058025) for a real-world example, and [the bisect documentation](https://pkg.go.dev/golang.org/x/tools/cmd/bisect) for more details. - -## Does this mean I don’t have to write x := x in my loops anymore? - -Not yet. But we hope that in a future version of Go you won't have to, perhaps even Go 1.22. - -## How can I send feedback? - -The [proposal issue](https://github.com/golang/go/issues/60078) is the place to discuss the proposal. However, please note that arguments about what is intuitive or natural are not productive: different people can quite reasonably have different opinions of what is intuitive or natural. - -Instead, the most important feedback you can contribute to the discussion is _empirical data about using the change on real codebases_: - - - What fraction of tests started failing with `GOEXPERIMENT=loopvar`? - - Were any of the newly failing tests caused by `GOEXPERIMENT=loopvar` breaking correct production code, as opposed to identifying buggy code or tests? - - Do any of your important, real-world benchmarks get significantly slower or use significantly more memory? - - - diff --git a/MacOS12BSDThreadRegisterIssue.md b/MacOS12BSDThreadRegisterIssue.md index 1df70da4..b030f27e 100644 --- a/MacOS12BSDThreadRegisterIssue.md +++ b/MacOS12BSDThreadRegisterIssue.md @@ -1,31 +1,4 @@ -# Introduction +The Go wiki on GitHub has moved to go.dev (#61940). -If you reached this page because you saw an error message like the following printed by a Go program running on macOS 12 Monterey: -``` -fatal error: runtime: bsdthread_register error +Try or . -runtime stack: -runtime.throw(0x20594e0, 0x21) - /usr/local/go/src/runtime/panic.go:619 +0x81 fp=0x7ff7bfeff878 sp=0x7ff7bfeff858 pc=0x1029751 -runtime.goenvs() - /usr/local/go/src/runtime/os_darwin.go:129 +0x83 fp=0x7ff7bfeff8a8 sp=0x7ff7bfeff878 pc=0x10272d3 -runtime.schedinit() - /usr/local/go/src/runtime/proc.go:496 +0xa4 fp=0x7ff7bfeff900 sp=0x7ff7bfeff8a8 pc=0x102c014 -runtime.rt0_go(0x7ff7bfeff930, 0x3, 0x7ff7bfeff930, 0x1000000, 0x3, 0x7ff7bfeffab0, 0x7ff7bfeffabf, 0x7ff7bfeffac3, 0x0, 0x7ff7bfeffacc, ...) - /usr/local/go/src/runtime/asm_amd64.s:252 +0x1f4 fp=0x7ff7bfeff908 sp=0x7ff7bfeff900 pc=0x1052c64 -``` -then you are running a program built with an old version of Go (Go 1.10 or before). You will need to update your program or rebuild it with a newer version of Go. - -# Details - -Programs built with Go 1.10 or before use a way of issuing system calls that is no longer supported by the kernel on macOS 12 Monterey. In [Go 1.11](https://go.dev/doc/go1.11#runtime) and later, system calls are issued via `libSystem.dylib`, which is supported by the OS. - -# What to do - -If this is a program you downloaded or installed (for example, using Homebrew), you will need to download or install a newer version of it that is built with a newer version of Go. - -If this is a program you built from source, you will need to rebuild it with a newer version of Go. - -You might want to check your $PATH and manually clean up `$GOPATH/bin` and other old relevant Go binaries you've installed. - -If you're trying to compile Go, `go tool dist clean` might help. \ No newline at end of file diff --git a/MethodSets.md b/MethodSets.md index 9d054eba..eb2af269 100644 --- a/MethodSets.md +++ b/MethodSets.md @@ -1,137 +1,4 @@ -Table of Contents -================= +The Go wiki on GitHub has moved to go.dev (#61940). -+ [Introduction](#introduction) -+ [The Spec](#the-spec) -+ [Usage](#usage) - + [Variables](#variables) - + [Slice Elements](#slice-elements) - + [Map Elements](#map-elements) - + [Interfaces](#interfaces) +Try or . -# Introduction - -Method sets of a particular type or value are of particular importance in Go, where the method set determines what interfaces a value implements. - -# The Spec - -There are two important clauses in the [Go Language Specification](https://go.dev/ref/spec) about method sets. They are as follows: - -[Method Sets](https://go.dev/ref/spec#Method_sets): -A type may have a method set associated with it. The method set of an interface type is its interface. The method set of any other named ` type T ` consists of all methods with receiver type ` T `. The method set of the corresponding pointer type ` *T ` is the set of all methods with receiver ` *T ` or ` T ` (that is, it also contains the method set of ` T `). Any other type has an empty method set. In a method set, each method must have a unique name. - -[Calls](https://go.dev/ref/spec#Calls): -A method call ` x.m() ` is valid if the method set of (the type of) ` x ` contains ` m ` and the argument list can be assigned to the parameter list of ` m `. If ` x ` is addressable and ` &x `'s method set contains ` m `, ` x.m() ` is shorthand for ` (&x).m() `. - -# Usage -There are many different cases during which a method set crops up in day-to-day programming. Some of the main ones are when calling methods on variables, calling methods on slice elements, calling methods on map elements, and storing values in interfaces. - -## Variables -In general, when you have a variable of a type, you can pretty much call whatever you want on it. When you combine the two rules above together, the following is valid: - -```go -type List []int - -func (l List) Len() int { return len(l) } -func (l *List) Append(val int) { *l = append(*l, val) } - -func main() { - // A bare value - var lst List - lst.Append(1) - fmt.Printf("%v (len: %d)\n", lst, lst.Len()) - - // A pointer value - plst := new(List) - plst.Append(2) - fmt.Printf("%v (len: %d)\n", plst, plst.Len()) -} -``` - -Note that both pointer and value methods can both be called on both pointer and non-pointer values. To understand why, let's examine the method sets of both types, directly from the spec: - -```go -List -- Len() int - -*List -- Len() int -- Append(int) -``` - -Notice that the method set for ` List ` does not actually contain ` Append(int) ` even though you can see from the above program that you can call the method without a problem. This is a result of the second spec section above. It implicitly translates the first line below into the second: - -```go -lst.Append(1) -(&lst).Append(1) -``` - -Now that the value before the dot is a ` *List `, its method set includes Append, and the call is legal. - -To make it easier to remember these rules, it may be helpful to simply consider the pointer- and value-receiver methods separately from the method set. It is legal to call a pointer-valued method on anything that is already a pointer or whose address can be taken (as is the case in the above example). It is legal to call a value method on anything which is a value or whose value can be dereferenced (as is the case with any pointer; this case is specified explicitly in the spec). - -## Slice Elements -Slice elements are almost identical to variables. Because they are addressable, both pointer- and value-receiver methods can be called on both pointer- and value-element slices. - -## Map Elements -Map elements are not addressable. Therefore, the following is an _illegal_ operation: - -```go -lists := map[string]List{} -lists["primes"].Append(7) // cannot be rewritten as (&lists["primes"]).Append(7) -``` - -However, the following is still valid (and is the far more common case): - -```go -lists := map[string]*List{} -lists["primes"] = new(List) -lists["primes"].Append(7) -count := lists["primes"].Len() // can be rewritten as (*lists["primes"]).Len() -``` - -Thus, both pointer- and value-receiver methods can be called on pointer-element maps, but only value-receiver methods can be called on value-element maps. This is the reason that maps with struct elements are almost always made with pointer elements. - -## Interfaces -The concrete value stored in an interface is not addressable, in the same way that a map element is not addressable. Therefore, when you call a method on an interface, it must either have an identical receiver type or it must be directly discernible from the concrete type: pointer- and value-receiver methods can be called with pointers and values respectively, as you would expect. Value-receiver methods can be called with pointer values because they can be dereferenced first. Pointer-receiver methods cannot be called with values, however, because the value stored inside an interface has no address. When assigning a value to an interface, the compiler ensures that all possible interface methods can actually be called on that value, and thus trying to make an improper assignment will fail on compilation. To extend the earlier example, the following describes what is valid and what is not: - -```go -type List []int - -func (l List) Len() int { return len(l) } -func (l *List) Append(val int) { *l = append(*l, val) } - -type Appender interface { - Append(int) -} - -func CountInto(a Appender, start, end int) { - for i := start; i <= end; i++ { - a.Append(i) - } -} - -type Lener interface { - Len() int -} - -func LongEnough(l Lener) bool { - return l.Len()*10 > 42 -} - -func main() { - // A bare value - var lst List - CountInto(lst, 1, 10) // INVALID: Append has a pointer receiver - if LongEnough(lst) { // VALID: Identical receiver type - fmt.Printf(" - lst is long enough") - } - - // A pointer value - plst := new(List) - CountInto(plst, 1, 10) // VALID: Identical receiver type - if LongEnough(plst) { // VALID: a *List can be dereferenced for the receiver - fmt.Printf(" - plst is long enough") - } -} -``` \ No newline at end of file diff --git a/MinimumRequirements.md b/MinimumRequirements.md index f8be80e2..0bdabf14 100644 --- a/MinimumRequirements.md +++ b/MinimumRequirements.md @@ -1,147 +1,4 @@ -# Minimum Requirements +The Go wiki on GitHub has moved to go.dev (#61940). -## Operating Systems +Try or . -### [Linux](Linux) - -Kernel version 2.6.32 or later. [_This depends on architecture though, we need to have specific builder for this._] Linux/ARMv5 requires much newer kernels, at least v3.1 (for `__kuser_cmpxchg64`). - -We don't support CentOS 5. The kernel is too old (2.6.18). - -For little-endian MIPS64, kernel version [4.1 is known to fail, and 4.8 works](https://go.dev/issue/16848). - -If you are using tinyconfig (e.g. make tinyconfig) for embedded systems, you will also almost certainly enable printk in the kernel as well as a console; we will not include those generic options here. For Go, you must also enable CONFIG_FUTEX. - -On arm64, an out of date (lower than version 2.33) ld.gold may cause shared library tests to fail (see https://github.com/golang/go/issues/28334). - -### [Windows](Windows) - -For Go 1.10: Windows XP (w/ Service Pack 3) or higher. - -For Go 1.11 and later: Windows 7 and higher or Windows Server 2008 R2 and higher. We test on Windows Server 2008 R2, 2012 R2, and 2016, which are roughly Windows 7, Windows 8.1, and Windows 10. - -For Go 1.21 and later: Windows 10 and higher or Windows Server 2016 and higher. - -### [macOS (née OS X, aka Darwin)](Darwin) - -macOS Sierra 10.12 or higher requires Go 1.7.1 or above. - -macOS Monterey 12 or higher requires Go 1.11 or above. - -Go 1.15 and later only support macOS Sierra 10.12 or newer; see https://go.dev/doc/go1.15#darwin. - -Go 1.17 and later only support macOS High Sierra 10.13 or newer; see https://go.dev/doc/go1.17#darwin. - -Go 1.21 and later will support macOS Catalina 10.15 or newer; see https://go.dev/doc/go1.20#darwin. - -We have builders for macOS 10.14 through macOS 13 as of 2023-05-31. - -### [OpenBSD](OpenBSD) - -The current officially supported -stable versions only. - -### [DragonFly BSD](DragonFly-BSD) - -Generally only the latest release version only. We have a builder, but it's not the most stable of our ports. - -### [FreeBSD](FreeBSD) - -See https://go.dev/wiki/FreeBSD#go-on-freebsd for supported FreeBSD/Architecture/Go versions matrix. - -### [NetBSD](NetBSD) - -There are known NetBSD bugs (including kernel crashes) up to the current NetBSD 7.1. There is a reported fix in NetBSD 7.1.1 but it's unverified as of 2017-07-10, as we're not running builders again yet. See https://tip.golang.org/doc/go1.9#known_issues and https://github.com/golang/go/issues/20852 - -### [Solaris](Solaris) - -illumos (former OpenSolaris 10) based distributions or Oracle Solaris 11+. - -### iOS - -iOS 12 or later. - -## Architectures - -### Microarchitecture support - -For some architectures, Go supports compiling to specific microarchitectures using environment variables, e.g. GOAMD64 for go1.18 and later. Binaries will check at startup whether the requested microarchitecture level is supported. For example, a binary built with `GOAMD64=v3` will fail on a CPU that doesn't have LZCNT support. - -Various microarchitecture levels and the environment variables used to select them are described with each architecture. - -The build cache understands the microarchitecture environment variables and does not require any cleaning if you change them. - -While performance is expected to improve when a higher minimum microarchitecture is requested, this might not be true in all cases. Benchmark your performance-critical code to verify performance improvements. - -### amd64 - -Until Go 1.17, the Go compiler always generated x86 binaries that could be executed by any 64-bit x86 processor. - -Go 1.18 introduced [4 architectural levels](https://en.wikipedia.org/wiki/X86-64#Microarchitecture_levels) for AMD64. -Each level differs in the set of x86 instructions that the compiler can include in the generated binaries: - -* GOAMD64=v1 (default): The baseline. Exclusively generates instructions that all 64-bit x86 processors can execute. -* GOAMD64=v2: all v1 instructions, plus CMPXCHG16B, LAHF, SAHF, POPCNT, SSE3, SSE4.1, SSE4.2, SSSE3. -* GOAMD64=v3: all v2 instructions, plus AVX, AVX2, BMI1, BMI2, F16C, FMA, LZCNT, MOVBE, OSXSAVE. -* GOAMD64=v4: all v3 instructions, plus AVX512F, AVX512BW, AVX512CD, AVX512DQ, AVX512VL. - -Setting, for example, GOAMD64=v3, will allow the Go compiler to use AVX2 instructions in the generated binaries (which may improve performance in some cases); but these binaries will not run on older x86 processors that don't support AVX2. - -The Go toolchain may also generate newer instructions, but guarded by dynamic checks to ensure they're only executed on capable processors. For example, with GOAMD64=v1, [math/bits.OnesCount](https://pkg.go.dev/math/bits#OnesCount) will still use the [POPCNT](https://www.felixcloutier.com/x86/popcnt) instruction if [CPUID](https://www.felixcloutier.com/x86/cpuid) reports that it's available. Otherwise, it falls back to a generic implementation. - -The Go toolchain does not currently generate any AVX512 instructions. - -Note that *processor* is a simplification in this context. In practice, support from the entire system (firmware, hypervisor, kernel) is needed. - -See section [Microarchitecture support](#microarchitecture-support) for hints on how to use microarchitecture environment variables like GOAMD64. - -### 386 - -See https://go.dev/doc/install/source#environment - -* GO386=sse2 (default): Any processor with at least SSE2 -* GO386=softfloat: All Pentium MMX or later processors (uses software floating point emulation) - -### arm - -See https://go.dev/doc/install/source#environment - -* GOARM=5: use software floating point; when CPU doesn't have VFP co-processor -* GOARM=6: use VFPv1 only; default if cross compiling; usually ARM11 or better cores (VFPv2 or better is also supported) -* GOARM=7: use VFPv3; usually Cortex-A cores - -### arm64 - -All ARMv8-A processors. - -### ppc64 (big endian) - -POWER5 and above. -Starting with Go 1.9, only POWER8 and above are supported. - -### ppc64le (little endian) - -POWER8 and above. - -### mips64 (big endian) - -MIPS III or higher. Builder is using MIPS64r2. - -### mips64le (little endian) - -MIPS III or higher in little endian mode. - -### s390x - -z13 - -### mips (big endian) and mipsle (little endian) - -MIPS32r1 - -### riscv64 - -rv64g (rv64imafd) - -## cgo - -For programs using cgo, gcc 4.6 or newer is required. \ No newline at end of file diff --git a/MinorReleases.md b/MinorReleases.md index de602549..fe10654b 100644 --- a/MinorReleases.md +++ b/MinorReleases.md @@ -1,69 +1,4 @@ -Our default decision should always be to not backport, but fixes for **security issues**, **serious problems with no workaround**, and **documentation fixes** are backported to the most recent two release branches, if applicable to that branch. (for example, the most current two release branches are `release-branch.go1.16` and `release-branch.go1.17`, from which new `Go 1.16.x` and `Go 1.17.x` releases are cut) Fixes for experimental ports are generally not backported. +The Go wiki on GitHub has moved to go.dev (#61940). -A “serious” problem is one that prevents a program from working at all. +Try or . -As soon as an interested party thinks an issue should be considered for backport, they open one or two “child” issues titled like `package: title [1.17 backport]`. The issue should include a link to the original issue and a short rationale about why the backport might be needed. - -GopherBot is capable of opening the backport issues automatically in response to comments like the following on the main issue. (The keywords are `@gopherbot`, `backport`, `please` and optionally the release. The entire message is quoted in the new issue.) - -> @gopherbot please consider this for backport to 1.17, it's a regression. - -> @gopherbot please open the backport tracking issues. This is a severe compiler bug. - -The fix is developed for the main issue, which is closed when the fix is merged to the master branch. - -The child issue is assigned to the minor release milestone and labeled **CherryPickCandidate**, and its candidacy is discussed there. Once it is approved it transitions to **CherryPickApproved**. Release managers (a subset of the Go team that handles the release process) and/or code owners approve cherry-picks via an informal process. - -When the child issue is labeled **CherryPickApproved**, the original author of the change fixing -that issue should immediately [create and mail a cherry-pick change](#making-cherry-pick-cls) against the release branch, which will be merged as soon as it is ready, closing the child issue. - -At release time, any open backport issue which is not release-blocker is pushed to the next minor release milestone, and a minor release is minted with the already merged changes. - -## Making cherry-pick CLs - -_Note that only the authors of the original CL and approvers have the ability to create the cherry-pick._ - -Once the main fix has been submitted to master, please make a cherry-pick CL to the applicable release branch. - -You can use the Gerrit UI to make a cherry-pick if there are no merge conflicts: - -![Top right corner > More > Cherry-pick](https://user-images.githubusercontent.com/1225294/39773359-dc0c2b3a-52c5-11e8-836a-c518186e0ab3.png) - -In the popup enter the branch name (like `release-branch.go1.10`), add the commit message prefix (like `[release-branch.go1.10]`), update the "Fixes" line and do not change any of the other automated lines. - -To cherry-pick from the command line or to resolve a merge conflict, take note of the final commit hash, then use `git codereview` and `git cherry-pick` to prepare a cherry-pick CL: - -``` -git checkout release-branch.go1.17 -git codereview change cherry-pick-NNNN -git cherry-pick $COMMIT_HASH -git commit --amend # add message prefix and change Fixes line -git codereview mail -``` - -**The cherry-pick CL must include a message prefix like `[release-branch.go1.10]`, and update the "Fixes" line to the child issue. Do not change or remove the "Change-Id" line nor the other Gerrit lines.** - -Gerrit is configured to only allow release managers to submit to release branches, but the code review process is otherwise the usual. - -At this time, it's not possible to make a cherry-pick CL by sending a [[Pull Request|GerritBot]]. Only Gerrit is supported. See [golang.org/issue/30037](https://go.dev/issue/30037). - -### Cherry-pick CLs for vendored golang.org/x packages - -The Go standard library includes some generated files whose source of truth is outside the main repository, in golang.org/x repositories. For example, a copy of the `golang.org/x/sys/unix` package is [vendored](https://go.googlesource.com/go/+/go1.16/src/cmd/vendor/modules.txt#45) into the Go tree, and a copy of the `golang.org/x/net/http2` package is [bundled](https://go.googlesource.com/go/+/go1.16/src/net/http/http.go#5). That means a fix to a golang.org/x package that needs to be backported to a Go release will need two corresponding CLs: - -1. In the golang.org/x repository, cherry-pick the fix from the `master` branch to the `internal-branch.go1.x-vendor` branch. - - The commit message should include "Updates golang/go#nnn" to mention the backport issue. - -2. In the main repository on the `release-branch.go1.x` branch, create a CL that pulls in the fix from the golang.org/x internal branch: - - ``` - go get golang.org/x/repo@internal-branch.go1.x-vendor - go mod tidy - go mod vendor - go generate -run=bundle std # If a bundled package needs regeneration. - ``` - - The commit message should include "Fixes #nnn" to close the backport issue. - -(As of Go 1.16, the golang.org/x branch name is always `internal-branch.go1.x-vendor`. In Go 1.15, the name of the golang.org/x branch is `release-branch.go1.x` or `release-branch.go1.x-bundle` in [special cases](https://go.dev/cl/305489).) diff --git a/Mobile.md b/Mobile.md index f5f74fec..3312b4bd 100644 --- a/Mobile.md +++ b/Mobile.md @@ -1,231 +1,4 @@ -**The Go mobile subrepository adds support for mobile platforms (Android and iOS) and provides tools to build mobile applications.** +The Go wiki on GitHub has moved to go.dev (#61940). -There are two strategies you can follow to include Go into your mobile stack: +Try or . -- Writing all-Go native mobile applications. -- Writing SDK applications by generating bindings from a Go package and invoke them from Java (on Android) and Objective-C (on iOS). - -This article will contain step-by-step guides to explain how to achieve -these strategies. - -- [Tools](#tools) -- [Native applications](#native-applications) - - [Building and deploying to Android](#building-and-deploying-to-android) - - [Building and deploying to iOS](#building-and-deploying-to-ios) - - [App icon](#app-icon) -- [SDK applications](#sdk-applications-and-generating-bindings) - - [Building and deploying to Android](#building-and-deploying-to-android-1) - - [Building and deploying to iOS](#building-and-deploying-to-ios-1) - - [iOS Simulator](#ios-simulator) - -## Tools - -You need to have [Go 1.16 or above](https://go.dev/dl/) to install mobile tools. - -Go Mobile introduces a tool, [`gomobile`](https://golang.org/x/mobile/cmd/gomobile), -to help you with the build and the binding process. - -`gomobile` also supports [Go Modules](https://go.dev/ref/mod), e.g. using - -``` -$ gomobile bind -v -o android.aar -target=android ./package -``` - -under a project directory. - -On macOS, you will need to have [Xcode Command Line Tools](https://developer.apple.com/downloads/) installed. - -To install `gomobile` tools: - -``` -$ go install golang.org/x/mobile/cmd/gomobile@latest -$ gomobile init -``` - -The following sections will help you how to use the `gomobile` tool. - -## Native applications - -The native category includes applications entirely written in Go. Currently, the -[golang.org/x/mobile](https://pkg.go.dev/golang.org/x/mobile) -contains only a small set of packages that focus on: - -* App control and configuration -* OpenGL ES 2 and ES 3 bindings -* Asset management -* Event management -* Experimental packages include OpenAL bindings, audio, font, sprite and motion sensors - -There are various example native applications under [golang.org/x/mobile/example](https://golang.org/x/mobile/example). We will build and deploy the basic example both to an Android and iOS device. - -Grab the application. - -``` -$ go get -d golang.org/x/mobile/example/basic -``` - -### Building and deploying to Android - -Run `gomobile build` to build an Android APK. - -``` -$ gomobile build -target=android -androidapi 19 golang.org/x/mobile/example/basic -``` - -Build command will build an APK named basic.apk. - -If an AndroidManifest.xml is defined in the package directory, it is added to the APK output. Otherwise, a default manifest is generated. - -If you have the [adb](http://developer.android.com/tools/help/adb.html) command installed on your machine, you can use `gomobile install` to build and push the APK to your mobile device. - -``` -$ gomobile install golang.org/x/mobile/example/basic -``` - -### Building and deploying to iOS - -Run `gomobile build` to build the package as an iOS application. - -Note: target=ios requires the host machine running macOS. You need to obtain a [signing identity and download provisioning profiles](https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/MaintainingCertificates/MaintainingCertificates.html) in order to continue. - -``` -$ gomobile build -target=ios golang.org/x/mobile/example/basic -``` - -The build command will build an application bundle, named `basic.app`. - -You can deploy .app files by dragging and dropping them to the device. - -* In Xcode, open Window > Devices. -* Select the physical device from the left pane. -* Drag and drop the .app file to "Installed Apps" section. -* Check the "Copy items if needed" option - -![Deploying app bundle](http://i.imgur.com/fRbQ0EQ.png) - -Alternatively, you can deploy application bundles to your iOS device by using the [ios-deploy](https://github.com/phonegap/ios-deploy) utility command line tool. Use ios-deploy to push the application to your device. - -``` -$ ios-deploy -b basic.app -``` - -### App icon - -It is possible to set an app icon by creating `assets/icon.png`. - -## SDK applications and generating bindings - -In this category, we will show you how you can use a Go package in -your existing Android or iOS application. - -The advantages to following this strategy: - -* You can reuse a Go package from a mobile app without making significant changes to your existing application. -* In cases where you want to share a common code base between your Android and iOS application, you can write the common functionality once in Go and glue them to the platform-specific code by invoking the Go package through bindings. - -Current limitations are listed below. - -* Only a [subset of Go types](https://pkg.go.dev/golang.org/x/mobile/cmd/gobind) are currently supported. -* Language bindings have a performance overhead. -* There are a few limitations on how the exported APIs should look due to the limitations of the target language. - -We will use the example package under [golang.org/x/mobile/example/bind/hello](https://golang.org/x/mobile/example/bind/hello) to generate bindings and invoke Greetings function from Java and Objective-C. - -Grab the example by running the command below. - -``` -$ go get -d golang.org/x/mobile/example/bind/... -``` - -### Building and deploying to Android - -Note: Go Mobile runs on the same architectures as Go, which currently means ARM, ARM64, 386 and amd64 devices and emulators. Notably, Android on MIPS devices is not yet supported. - -* Run the following command to generate the [aar](https://developer.android.com/studio/projects/android-library.html) file that is suitable for importing into Android projects: - -``` -$ gomobile bind -o app/hello.aar -target=android golang.org/x/mobile/example/bind/hello -``` - -Tips: From 1.16, it is recommended to execute `go get -d golang.org/x/mobile/cmd/gomobile` before each execution of `gomobile bind ...`. go get will automatically add indirect references to go.mod. These indirect references maybe automatically deleted by ide or go mod tidy, but they are required! -``` -require ( - golang.org/x/mobile v0.0.0-20210716004757-34ab1303b554 // indirect - golang.org/x/mod v0.4.2 // indirect - golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect - golang.org/x/tools v0.1.2 // indirect - golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect -) -``` - -* Launch Android Studio. -* File > Import Project... to import the reference project from $GOPATH/src/golang.org/x/mobile/example/bind/android. - -![Android Studio](http://i.imgur.com/RhNCnnH.png) - -* Build and deploy the application to the device. - -The app module contains the main application that invokes the `hello.Greetings`. When the application is launched the text view is updated with the string returned value. - -If you are not using Android Studio, in order to work with bindings for Android, you need to have [Android SDK](https://developer.android.com/sdk/index.html#Other) installed and ANDROID_HOME environment variable set to the SDK path. You also need the [NDK](https://developer.android.com/ndk/) installed; the easiest way is to run the SDK command `sdkmanager ndk-bundle`. - -Alternatively, if you are not familiar with android development, and you do not wish to set up all the required environment (Android SDK, Gradle, etc), you can use [this](https://github.com/AgregoreWeb/gomobile-android-docker) docker image to build the application in [docker](https://www.docker.com/) instead. - -Besides, if you try to add yourmodule.aar into your own project, after copy the yourmodule.aar file and yourmodule.jar file to "android\app" folder, below editing in "android\app\build.gradle" file should be done in order to make your module imported correctly. - -``` -+ repositories { -+ flatDir { -+ dirs '.' -+ } -+ } -``` - -``` -dependencies { -... -+ implementation (name:'yourmodulename', ext:'aar') -} -``` - -### Building and deploying to iOS - -Note: target=ios requires the host machine to be running macOS. - -``` -$ cd $GOPATH/src/golang.org/x/mobile/example/bind -$ gomobile bind -target=ios golang.org/x/mobile/example/bind/hello -``` - -Gomobile bind will generate a framework bundle called `Hello.framework`. Open the sample Xcode project by running the command below. - -``` -$ open ios/bind.xcodeproj -``` -Drag and drop the `Hello.framework` bundle to the Xcode project. Check "Copy items if needed" if you need a different copy of the framework bundle within the Xcode otherwise. Otherwise, modifying the Go package source code and rerunning `gomobile bind` will update the hello.framework. - -![Drag and drop Hello.framework](http://i.imgur.com/u88CxN9.png) - -If you decide to keep `Hello.framework` in the main directory you have to add the main directory to the `Framework Search Paths` in the the targets Build Settings. - -![Framework Search Path in Xcode Project](https://i.imgur.com/UXEM2sj.png) - -Your project layout should look like what's shown below. - -![Xcode project layout with Hello.framework](http://i.imgur.com/JhcSKwC.png) - -Build and run it on the simulator or an actual device (Cmd+R). When the application launches, the label on the main view will be modified with the string returned from `GoHelloGreetings` which invokes the `hello.Greetings` function. - -Note that you can also invoke `GoHelloGreetings` from Swift by importing Hello. - -```swift -@import Hello -// ... -let msg = Hello.GoHelloGreetings("gopher") -``` - -#### iOS Simulator - -As of Go 1.5, only darwin/amd64 works on the iOS simulator. To use the simulator, you need to configure Xcode to only try to run 64-bit binaries. - -Xcode matches the bit width of the ARM binaries when running on the X86 simulator. That is, if you configure Xcode to build both 32-bit and 64-bit ARM binaries (the default), it will attempt to run 32-bit X86 binaries on the simulator, which will not work with Go today. Modify the Xcode build settings to only build 64-bit ARM binaries, and the simulator will run the amd64 binary. diff --git a/Modules.md b/Modules.md index c705b9f1..e8c6e39d 100644 --- a/Modules.md +++ b/Modules.md @@ -1,1451 +1,4 @@ -# Go Modules +The Go wiki on GitHub has moved to go.dev (#61940). -This wiki page serves as a usage and troubleshooting guide. -* For tutorial blog posts, see [Using Go Modules](https://go.dev/blog/using-go-modules). -* For a technical reference, see the [Go Modules Reference](https://go.dev/ref/mod) (under development). +Try or . -Go has included support for versioned modules as proposed [here](https://go.dev/design/24301-versioned-go) since 1.11. The initial prototype `vgo` was [announced](https://research.swtch.com/vgo) in February 2018. In July 2018, versioned modules [landed](https://groups.google.com/d/msg/golang-dev/a5PqQuBljF4/61QK4JdtBgAJ) in the main Go repository. - -Since [Go 1.14](https://go.dev/doc/go1.14), module support is considered ready for production use, and all users are encouraged to migrate to modules from other dependency management systems. If you are unable to migrate due to a problem in the Go toolchain, please ensure that the problem has an [open issue](#github-issues) filed. (If the issue is not on the Go1.16 milestone, please comment on why it prevents you from migrating so it can be prioritized appropriately). You can also provide an [experience report](https://github.com/golang/go/wiki/ExperienceReports) for more detailed feedback. - -## Recent Changes - -### Go 1.16 - -See the [Go 1.16 release notes](https://go.dev/doc/go1.16#go-command) for details. - -* Module mode (`GO111MODULE=on`) is the default in all cases -* Commands no longer modify `go.mod` / `go.sum` by default (`-mod=readonly`) -* `go install pkg@version` is the recommended way to globally install packages / executables -* `retract` is available in `go.mod` - -### Go 1.15 - -See the [Go 1.15 release notes](https://go.dev/doc/go1.15#go-command) for details. - -* The location of the module cache may now be set with the `GOMODCACHE` environment variable. The default value of `GOMODCACHE` is `GOPATH[0]/pkg/mod`, the location of the module cache before this change. -* A workaround is now available for Windows "Access is denied" errors in go commands that access the module cache, caused by external programs concurrently scanning the file system (see issue [#36568](https://go.dev/issue/36568)). The workaround is not enabled by default because it is not safe to use when Go versions lower than 1.14.2 and 1.13.10 are running concurrently with the same module cache. It can be enabled by explicitly setting the environment variable `GODEBUG=modcacheunzipinplace=1`. - -### Go 1.14 - -See the [Go 1.14 release notes](https://go.dev/doc/go1.14#go-command) for details. - -* When the main module contains a top-level vendor directory and its `go.mod file` specifies `go 1.14` or higher, the go command now defaults to `-mod=vendor` for operations that accept that flag. -* `-mod=readonly` is now set by default when the go.mod file is read-only and no top-level vendor directory is present. -* `-modcacherw` is a new flag that instructs the go command to leave newly-created directories in the module cache at their default permissions rather than making them read-only. -* `-modfile=file` is a new flag that instructs the go command to read (and possibly write) an alternate `go.mod` file instead of the one in the module root directory. -* When module-aware mode is enabled explicitly (by setting `GO111MODULE=on`), most module commands have more limited functionality if no `go.mod` file is present. -* The go command now supports Subversion repositories in module mode. - -### Go 1.13 - -See the [Go 1.13 release notes](https://go.dev/doc/go1.13#modules) for details. - -* The `go` tool now defaults to downloading modules from the public Go module mirror at https://proxy.golang.org, and also defaults to validating downloaded modules (regardless of source) against the public Go checksum database at https://sum.golang.org. - * If you have private code, you most likely should configure the `GOPRIVATE` setting (such as `go env -w GOPRIVATE=*.corp.com,github.com/secret/repo`), or the more fine-grained variants `GONOPROXY` or `GONOSUMDB` that support less frequent use cases. See the [documentation](https://go.dev/ref/mod#private-module-privacy) for more details. -* `GO111MODULE=auto` enables module-mode if any go.mod is found, even inside GOPATH. (Prior to Go 1.13, `GO111MODULE=auto` would never enable module-mode inside GOPATH). -* `go get` arguments have changed: - * `go get -u` (without any arguments) now only upgrades the direct and indirect dependencies of your current _package_, and no longer examines your entire _module_. - * `go get -u ./...` from your module root upgrades all the direct and indirect dependencies of your module, and now excludes test dependencies. - * `go get -u -t ./...` is similar, but also upgrades test dependencies. - * `go get` no longer supports `-m` (because it would have largely overlapped with `go get -d` due to other changes; you can usually replace `go get -m foo` with `go get -d foo`). - -## Table of Contents - -The "Quick Start" and "New Concepts" sections are particularly important for someone who is starting to work with modules. The "How to..." sections cover more details on mechanics. The largest quantity of content on this page is in the FAQs answering more specific questions; it can be worthwhile to at least skim the FAQ one-liners listed here. - -* [Quick Start](https://github.com/golang/go/wiki/Modules#quick-start) - * [Example](https://github.com/golang/go/wiki/Modules#example) - * [Daily Workflow](https://github.com/golang/go/wiki/Modules#daily-workflow) -* [New Concepts](https://github.com/golang/go/wiki/Modules#new-concepts) - * [Modules](https://github.com/golang/go/wiki/Modules#modules) - * [go.mod](https://github.com/golang/go/wiki/Modules#gomod) - * [Version Selection](https://github.com/golang/go/wiki/Modules#version-selection) - * [Semantic Import Versioning](https://github.com/golang/go/wiki/Modules#semantic-import-versioning) -* [How to Use Modules](https://github.com/golang/go/wiki/Modules#how-to-use-modules) - * [How to Install and Activate Module Support](https://github.com/golang/go/wiki/Modules#how-to-install-and-activate-module-support) - * [How to Define a Module](https://github.com/golang/go/wiki/Modules#how-to-define-a-module) - * [How to Upgrade and Downgrade Dependencies](https://github.com/golang/go/wiki/Modules#how-to-upgrade-and-downgrade-dependencies) - * [How to Prepare for a Release (All Versions)](https://github.com/golang/go/wiki/Modules#how-to-prepare-for-a-release) - * [How to Prepare for a Release (v2 or Higher)](https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher) - * [Publishing a Release](https://github.com/golang/go/wiki/Modules#publishing-a-release) -* [Migrating to Modules](https://github.com/golang/go/wiki/Modules#migrating-to-modules) -* [Additional Resources](https://github.com/golang/go/wiki/Modules#additional-resources) -* [Changes Since the Initial Vgo Proposal](https://github.com/golang/go/wiki/Modules#changes-since-the-initial-vgo-proposal) -* [GitHub Issues](https://github.com/golang/go/wiki/Modules#github-issues) -* [FAQs](https://github.com/golang/go/wiki/Modules#faqs) - * [How are versions marked as incompatible?](https://github.com/golang/go/wiki/Modules#how-are-versions-marked-as-incompatible) - * [When do I get old behavior vs. new module-based behavior?](https://github.com/golang/go/wiki/Modules#when-do-i-get-old-behavior-vs-new-module-based-behavior) - * [Why does installing a tool via 'go get' fail with error 'cannot find main module'?](https://github.com/golang/go/wiki/Modules#why-does-installing-a-tool-via-go-get-fail-with-error-cannot-find-main-module) - * [How can I track tool dependencies for a module?](https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module) - * [What is the status of module support in IDEs, editors and standard tools like goimports, gorename, etc.?](https://github.com/golang/go/wiki/Modules#what-is-the-status-of-module-support-in-ides-editors-and-standard-tools-like-goimports-gorename-etc) -* [FAQs — Additional Control](https://github.com/golang/go/wiki/Modules#faqs--additional-control) - * [What community tooling exists for working with modules?](https://github.com/golang/go/wiki/Modules#what-community-tooling-exists-for-working-with-modules) - * [When should I use the 'replace' directive?](https://github.com/golang/go/wiki/Modules#when-should-i-use-the-replace-directive) - * [Can I work entirely outside of VCS on my local filesystem?](https://github.com/golang/go/wiki/Modules#can-i-work-entirely-outside-of-vcs-on-my-local-filesystem) - * [How do I use vendoring with modules? Is vendoring going away?](https://github.com/golang/go/wiki/Modules#how-do-i-use-vendoring-with-modules-is-vendoring-going-away) - * [Are there "always on" module repositories and enterprise proxies?](https://github.com/golang/go/wiki/Modules#are-there-always-on-module-repositories-and-enterprise-proxies) - * [Can I control when go.mod gets updated and when the go tools use the network to satisfy dependencies?](https://github.com/golang/go/wiki/Modules#can-i-control-when-gomod-gets-updated-and-when-the-go-tools-use-the-network-to-satisfy-dependencies) - * [How do I use modules with CI systems such as Travis or CircleCI?](https://github.com/golang/go/wiki/Modules#how-do-i-use-modules-with-ci-systems-such-as-travis-or-circleci) - * [How do I download modules needed to build specific packages or tests?](https://github.com/golang/go/wiki/Modules#how-do-i-download-modules-needed-to-build-specific-packages-or-tests) -* [FAQs — go.mod and go.sum](https://github.com/golang/go/wiki/Modules#faqs--gomod-and-gosum) - * [Why does 'go mod tidy' record indirect and test dependencies in my 'go.mod'?](https://github.com/golang/go/wiki/Modules#why-does-go-mod-tidy-record-indirect-and-test-dependencies-in-my-gomod) - * [Is 'go.sum' a lock file? Why does 'go.sum' include information for module versions I am no longer using?](https://github.com/golang/go/wiki/Modules#is-gosum-a-lock-file-why-does-gosum-include-information-for-module-versions-i-am-no-longer-using) - * [Should I still add a 'go.mod' file if I do not have any dependencies?](https://github.com/golang/go/wiki/Modules#should-i-still-add-a-gomod-file-if-i-do-not-have-any-dependencies) - * [Should I commit my 'go.sum' file as well as my 'go.mod' file?](https://github.com/golang/go/wiki/Modules#should-i-commit-my-gosum-file-as-well-as-my-gomod-file) -* [FAQs — Semantic Import Versioning](https://github.com/golang/go/wiki/Modules#faqs--semantic-import-versioning) - * [Why must major version numbers appear in import paths?](https://github.com/golang/go/wiki/Modules#why-must-major-version-numbers-appear-in-import-paths) - * [Why are major versions v0, v1 omitted from import paths?](https://github.com/golang/go/wiki/Modules#why-are-major-versions-v0-v1-omitted-from-import-paths) - * [What are some implications of tagging my project with major version v0, v1, or making breaking changes with v2+?](https://github.com/golang/go/wiki/Modules#what-are-some-implications-of-tagging-my-project-with-major-version-v0-v1-or-making-breaking-changes-with-v2) - * [Can a module consume a package that has not opted in to modules?](https://github.com/golang/go/wiki/Modules#can-a-module-consume-a-package-that-has-not-opted-in-to-modules) - * [Can a module consume a v2+ package that has not opted into modules? What does '+incompatible' mean?](https://github.com/golang/go/wiki/Modules#can-a-module-consume-a-v2-package-that-has-not-opted-into-modules-what-does-incompatible-mean) - * [How are v2+ modules treated in a build if modules support is not enabled? How does "minimal module compatibility" work in 1.9.7+, 1.10.3+, and 1.11?](https://github.com/golang/go/wiki/Modules#how-are-v2-modules-treated-in-a-build-if-modules-support-is-not-enabled-how-does-minimal-module-compatibility-work-in-197-1103-and-111) - * [What happens if I create a go.mod but do not apply semver tags to my repository?](https://github.com/golang/go/wiki/Modules#what-happens-if-i-create-a-gomod-but-do-not-apply-semver-tags-to-my-repository) - * [Can a module depend on a different version of itself?](https://github.com/golang/go/wiki/Modules#can-a-module-depend-on-a-different-version-of-itself) -* [FAQs — Multi-Module Repositories](https://github.com/golang/go/wiki/Modules#faqs--multi-module-repositories) - * [What are multi-module repositories?](https://github.com/golang/go/wiki/Modules#what-are-multi-module-repositories) - * [Should I have multiple modules in a single repository?](https://github.com/golang/go/wiki/Modules#should-i-have-multiple-modules-in-a-single-repository) - * [Is it possible to add a module to a multi-module repository?](https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository) - * [Is it possible to remove a module from a multi-module repository?](https://github.com/golang/go/wiki/Modules#is-it-possible-to-remove-a-module-from-a-multi-module-repository) - * [Can a module depend on an internal/ in another?](https://github.com/golang/go/wiki/Modules#can-a-module-depend-on-an-internal-in-another) - * [Can an additional go.mod exclude unnecessary content? Do modules have the equivalent of a .gitignore file?](https://github.com/golang/go/wiki/Modules#can-an-additional-gomod-exclude-unnecessary-content-do-modules-have-the-equivalent-of-a-gitignore-file) -* [FAQs — Minimal Version Selection](https://github.com/golang/go/wiki/Modules#faqs--minimal-version-selection) - * [Won't minimal version selection keep developers from getting important updates?](https://github.com/golang/go/wiki/Modules#wont-minimal-version-selection-keep-developers-from-getting-important-updates) -* [FAQs — Possible Problems](https://github.com/golang/go/wiki/Modules#faqs--possible-problems) - * [What are some general things I can spot check if I am seeing a problem?](https://github.com/golang/go/wiki/Modules#what-are-some-general-things-i-can-spot-check-if-i-am-seeing-a-problem) - * [What can I check if I am not seeing the expected version of a dependency?](https://github.com/golang/go/wiki/Modules#what-can-i-check-if-i-am-not-seeing-the-expected-version-of-a-dependency) - * [Why am I getting an error 'cannot find module providing package foo'?](https://github.com/golang/go/wiki/Modules#why-am-i-getting-an-error-cannot-find-module-providing-package-foo) - * [Why does 'go mod init' give the error 'cannot determine module path for source directory'?](https://github.com/golang/go/wiki/Modules#why-does-go-mod-init-give-the-error-cannot-determine-module-path-for-source-directory) - * [I have a problem with a complex dependency that has not opted in to modules. Can I use information from its current dependency manager?](https://github.com/golang/go/wiki/Modules#i-have-a-problem-with-a-complex-dependency-that-has-not-opted-in-to-modules-can-i-use-information-from-its-current-dependency-manager) - * [How can I resolve "parsing go.mod: unexpected module path" and "error loading module requirements" errors caused by a mismatch between import paths vs. declared module identity?](https://github.com/golang/go/wiki/Modules#how-can-i-resolve-parsing-gomod-unexpected-module-path-and-error-loading-module-requirements-errors-caused-by-a-mismatch-between-import-paths-vs-declared-module-identity) - * [Why does 'go build' require gcc, and why are prebuilt packages such as net/http not used?](https://github.com/golang/go/wiki/Modules#why-does-go-build-require-gcc-and-why-are-prebuilt-packages-such-as-nethttp-not-used) - * [Do modules work with relative imports like `import "./subdir"`?](https://github.com/golang/go/wiki/Modules#do-modules-work-with-relative-imports-like-import-subdir) - * [Some needed files may not be present in populated vendor directory](https://github.com/golang/go/wiki/Modules#some-needed-files-may-not-be-present-in-populated-vendor-directory) - -## Quick Start - -#### Example - -The details are covered in the remainder of this page, but here is a simple example of creating a module from scratch. - -Create a directory outside of your GOPATH, and optionally initialize VCS: -``` -$ mkdir -p /tmp/scratchpad/repo -$ cd /tmp/scratchpad/repo -$ git init -q -$ git remote add origin https://github.com/my/repo -``` - -Initialize a new module: -``` -$ go mod init github.com/my/repo - -go: creating new go.mod: module github.com/my/repo -``` - -Write your code: -``` -$ cat < hello.go -package main - -import ( - "fmt" - "rsc.io/quote" -) - -func main() { - fmt.Println(quote.Hello()) -} -EOF -``` - -Build and run: -``` -$ go mod tidy -go: finding module for package rsc.io/quote -go: found rsc.io/quote in rsc.io/quote v1.5.2 -$ go build -o hello -$ ./hello -Hello, world. -``` - -The `go.mod` file was updated to include explicit versions for your dependencies, where `v1.5.2` here is a [semver](https://semver.org) tag: -``` -$ cat go.mod -module github.com/my/repo - -go 1.16 - -require rsc.io/quote v1.5.2 -``` - -#### Daily Workflow - -Prior to 1.16, no `go get` or `go mod tidy` was required prior to running `go build -o hello`. Implicit modification of `go.mod` and `go.sum` files was disabled by default in 1.16. - -Your typical day-to-day workflow can be: - -* Add import statements to your `.go` code as needed. -* Standard commands like `go build` or `go test` will automatically add new dependencies as needed to satisfy imports (updating `go.mod` and downloading the new dependencies). -* When needed, more specific versions of dependencies can be chosen with commands such as `go get foo@v1.2.3`, `go get foo@master` (`foo@default` with mercurial), `go get foo@e3702bed2`, or by editing `go.mod` directly. - -A brief tour of other common functionality you might use: - -* `go list -m all` — View final versions that will be used in a build for all direct and indirect dependencies ([details](https://github.com/golang/go/wiki/Modules#version-selection)) -* `go list -u -m all` — View available minor and patch upgrades for all direct and indirect dependencies ([details](https://github.com/golang/go/wiki/Modules#how-to-upgrade-and-downgrade-dependencies)) -* `go get -u ./...` or `go get -u=patch ./...` (from module root directory) — Update all direct and indirect dependencies to latest minor or patch upgrades (pre-releases are ignored) ([details](https://github.com/golang/go/wiki/Modules#how-to-upgrade-and-downgrade-dependencies)) -* `go build ./...` or `go test ./...` (from module root directory) — Build or test all packages in the module ([details](https://github.com/golang/go/wiki/Modules#how-to-define-a-module)) -* `go mod tidy` — Prune any no-longer-needed dependencies from `go.mod` and add any dependencies needed for other combinations of OS, architecture, and build tags ([details](https://github.com/golang/go/wiki/Modules#how-to-prepare-for-a-release)) -* `replace` directive or `gohack` — Use a fork, local copy or exact version of a dependency ([details](https://github.com/golang/go/wiki/Modules#when-should-i-use-the-replace-directive)) -* `go mod vendor` — Optional step to create a `vendor` directory ([details](https://github.com/golang/go/wiki/Modules#how-do-i-use-vendoring-with-modules-is-vendoring-going-away)) - -After reading the next four sections on "New Concepts", you will have enough information to get started with modules for most projects. It is also useful to review the [Table of Contents](https://github.com/golang/go/wiki/Modules#table-of-contents) above (including the FAQ one-liners there) to familiarize yourself with the list of more detailed topics. - -## New Concepts - -These sections provide a high-level introduction to the main new concepts. For more details and rationale, please see this 40-minute introductory [video by Russ Cox describing the philosophy behind the design](https://www.youtube.com/watch?v=F8nrpe0XWRg&list=PLq2Nv-Sh8EbbIjQgDzapOFeVfv5bGOoPE&index=3&t=0s), the [official proposal document](https://go.dev/design/24301-versioned-go), or the more detailed initial [vgo blog series](https://research.swtch.com/vgo). - -### Modules - -A *module* is a collection of related Go packages that are versioned together as a single unit. - -Modules record precise dependency requirements and create reproducible builds. - -Most often, a version control repository contains exactly one module defined in the repository root. ([Multiple modules are supported in a single repository](https://github.com/golang/go/wiki/Modules#faqs--multi-module-repositories), but typically that would result in more work on an on-going basis than a single module per repository). - -Summarizing the relationship between repositories, modules, and packages: -* A repository contains one or more Go modules. -* Each module contains one or more Go packages. -* Each package consists of one or more Go source files in a single directory. - - Modules must be semantically versioned according to [semver](https://semver.org/), usually in the form `v(major).(minor).(patch)`, such as `v0.1.0`, `v1.2.3`, or `v1.5.0-rc.1`. The leading `v` is required. If using Git, [tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging) released commits with their versions. Public and private module repositories and proxies are becoming available (see FAQ [below](https://github.com/golang/go/wiki/Modules#are-there-always-on-module-repositories-and-enterprise-proxies)). - -### go.mod - -A module is defined by a tree of Go source files with a `go.mod` file in the tree's root directory. Module source code may be located outside of GOPATH. There are four directives: `module`, `require`, `replace`, `exclude`. - -Here is an example `go.mod` file defining the module `github.com/my/thing`: - -``` -module github.com/my/thing - -require ( - github.com/some/dependency v1.2.3 - github.com/another/dependency/v4 v4.0.0 -) -``` - -A module declares its identity in its `go.mod` via the `module` directive, which provides the _module path_. The import paths for all packages in a module share the module path as a common prefix. The module path and the relative path from the `go.mod` to a package's directory together determine a package's import path. - -For example, if you are creating a module for a repository `github.com/user/mymod` that will contain two packages with import paths `github.com/user/mymod/foo` and `github.com/user/mymod/bar`, then the first line in your `go.mod` file typically would declare your module path as `module github.com/user/mymod`, and the corresponding on-disk structure could be: - -``` -mymod -|-- bar -| `-- bar.go -|-- foo -| `-- foo.go -`-- go.mod -``` - -In Go source code, packages are imported using the full path including the module path. For example, if in our example above, we declared the module identity in `go.mod` as `module github.com/user/mymod`, a consumer could do: -``` -import "github.com/user/mymod/bar" -``` -This imports package `bar` from the module `github.com/user/mymod`. - -`exclude` and `replace` directives only operate on the current (“main”) module. `exclude` and `replace` directives in modules other than the main module are ignored when building the main module. The `replace` and `exclude` statements, therefore, allow the main module complete control over its own build, without also being subject to complete control by dependencies. (See FAQ [below](https://github.com/golang/go/wiki/Modules#when-should-i-use-the-replace-directive) for a discussion of when to use a `replace` directive). - -### Version Selection - -If you add a new import to your source code that is not yet covered by a `require` in `go.mod`, most go commands like 'go build' and 'go test' will automatically look up the proper module and add the *highest* version of that new direct dependency to your module's `go.mod` as a `require` directive. For example, if your new import corresponds to dependency M whose latest tagged release version is `v1.2.3`, your module's `go.mod` will end up with `require M v1.2.3`, which indicates module M is a dependency with allowed version >= v1.2.3 (and < v2, given v2 is considered incompatible with v1). - -The *minimal version selection* algorithm is used to select the versions of all modules used in a build. For each module in a build, the version selected by minimal version selection is always the semantically *highest* of the versions explicitly listed by a `require` directive in the main module or one of its dependencies. - -As an example, if your module depends on module A which has a `require D v1.0.0`, and your module also depends on module B which has a `require D v1.1.1`, then minimal version selection would choose `v1.1.1` of D to include in the build (given it is the highest listed `require` version). This selection of `v1.1.1` remains consistent even if sometime later a `v1.2.0` of D becomes available. This is an example of how the modules system provides 100% reproducible builds. When ready, the module author or user might choose to upgrade to the latest available version of D or choose an explicit version for D. - -For a brief rationale and overview of the minimal version selection algorithm, [see the "High Fidelity Builds" section](https://github.com/golang/proposal/blob/master/design/24301-versioned-go.md#update-timing--high-fidelity-builds) of the official proposal, or see the [more detailed `vgo` blog series](https://research.swtch.com/vgo). - -To see a list of the selected module versions (including indirect dependencies), use `go list -m all`. - -See also the ["How to Upgrade and Downgrade Dependencies"](https://github.com/golang/go/wiki/Modules#how-to-upgrade-and-downgrade-dependencies) section below and the ["How are versions marked as incompatible?"](https://github.com/golang/go/wiki/Modules#how-are-versions-marked-as-incompatible) FAQ below. - -### Semantic Import Versioning - -For many years, the official Go FAQ has included this advice on package versioning: - -> "Packages intended for public use should try to maintain backward compatibility as they evolve. The Go 1 compatibility guidelines are a good reference here: don't remove exported names, encourage tagged composite literals, and so on. If different functionality is required, add a new name instead of changing an old one. If a complete break is required, create a new package with a new import path." - -The last sentence is especially important — if you break compatibility, you should change the import path of your package. With Go 1.11 modules, that advice is formalized into the _import compatibility rule_: - -> "If an old package and a new package have the same import path, -> the new package must be backwards compatible with the old package." - -Recall [semver](https://semver.org/) requires a major version change when a v1 or higher package makes a backwards-incompatible change. The result of following both the import compatibility rule and semver is called _Semantic Import Versioning_, where the major version is included in the import path — this ensures the import path changes any time the major version increments due to a compatibility break. - -As a result of Semantic Import Versioning, code opting in to Go modules **must comply with these rules**: -* Follow [semver](https://semver.org/). (An example VCS tag is `v1.2.3`). -* If the module is version v2 or higher, the major version of the module _must_ be included as a `/vN` at the end of the module paths used in `go.mod` files (e.g., `module github.com/my/mod/v2`, `require github.com/my/mod/v2 v2.0.1`) and in the package import path (e.g., `import "github.com/my/mod/v2/mypkg"`). This includes the paths used in `go get` commands (e.g., `go get github.com/my/mod/v2@v2.0.1`. Note there is both a `/v2` and a `@v2.0.1` in that example. One way to think about it is that the module name now includes the `/v2`, so include `/v2` whenever you are using the module name). -* If the module is version v0 or v1, do _not_ include the major version in either the module path or the import path. - -In general, packages with different import paths are different packages. For example, `math/rand` is a different package than `crypto/rand`. This is also true if different import paths are due to different major versions appearing in the import path. Thus `example.com/my/mod/mypkg` is a different package than `example.com/my/mod/v2/mypkg`, and both may be imported in a single build, which among other benefits helps with diamond dependency problems and also allows a v1 module to be implemented in terms of its v2 replacement or vice versa. - -See the ["Module compatibility and semantic versioning"](https://pkg.go.dev/cmd/go/#hdr-Module_compatibility_and_semantic_versioning) section of the `go` command documentation for more details on Semantic Import Versioning, and see https://semver.org for more about semantic versioning. - -This section so far has been focused on code that has opted in to modules and imports other modules. However, putting major versions in import paths for v2+ modules could create incompatibilities with older versions of Go, or with code that has not yet opted in to modules. To help with this, there are three important transitional special cases or exceptions to the behavior and rules described above. These transitional exceptions will become less important over time as more packages opt in to modules. - -**Three Transitional Exceptions** - -1. **gopkg.in** - - Existing code that uses import paths starting with `gopkg.in` (such as `gopkg.in/yaml.v1` and `gopkg.in/yaml.v2`) can continue to use those forms for their module paths and import paths even after opting in to modules. - -2. **'+incompatible' when importing non-module v2+ packages** - - A module can import a v2+ package that has not opted in to modules itself. A non-module v2+ package that has a valid v2+ [semver](https://semver.org) tag will be recorded with a `+incompatible` suffix in the importing module's `go.mod` file. The `+incompatible` suffix indicates that even though the v2+ package has a valid v2+ [semver](https://semver.org) tag such as `v2.0.0`, the v2+ package has not actively opted in to modules and hence that v2+ package is assumed to have _not_ been created with an understanding of the implications of Semantic Import Versioning and how to use major versions in import paths. Therefore, when operating in [module mode](https://github.com/golang/go/wiki/Modules#when-do-i-get-old-behavior-vs-new-module-based-behavior), the `go` tool will treat a non-module v2+ package as an (incompatible) extension of the v1 version series of the package and assume the package has no awareness of Semantic Import Versioning, and the `+incompatible` suffix is an indication that the `go` tool is doing so. - -3. **"Minimal module compatibility" when module mode is not enabled** - - To help with backwards-compatibility, Go versions 1.9.7+, 1.10.3+ and 1.11 have been updated to make it easier for code built with those releases to be able to properly consume v2+ modules _without_ requiring modification of pre-existing code. This behavior is called "minimal module compatibility", and it only takes effect when full [module mode](https://github.com/golang/go/wiki/Modules#when-do-i-get-old-behavior-vs-new-module-based-behavior) is disabled for the `go` tool, such as if such as you have set `GO111MODULE=off` in Go 1.11, or are using Go versions 1.9.7+ or 1.10.3+. When relying on this "minimal module compatibility" mechanism in Go 1.9.7+, 1.10.3+ and 1.11, a package that has _not_ opted in to modules would _not_ include the major version in the import path for any imported v2+ modules. In contrast, a package that _has_ opted in to modules _must_ include the major version in the import path to import any v2+ modules (in order to properly import the v2+ module when the `go` tool is operating in full module mode with full awareness of Semantic Import Versioning). - -For the exact mechanics required to release a v2+ module, please see the ["Releasing Modules (v2 or Higher)"](https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher) section below. - -## How to Use Modules - -### How to Install and Activate Module Support - -To use modules, two install options are: -* [Install the latest Go 1.11 release](https://go.dev/dl/). -* [Install the Go toolchain from source](https://go.dev/doc/install/source) on the `master` branch. - -Once installed, you can then activate module support in one of two ways: -* Invoke the `go` command in a directory outside of the `$GOPATH/src` tree, with a valid `go.mod` file in the current directory or any parent of it and the environment variable `GO111MODULE` unset (or explicitly set to `auto`). -* Invoke the `go` command with `GO111MODULE=on` environment variable set. - -### How to Define a Module - -To create a `go.mod` for an existing project: - -1. Navigate to the root of the module's source tree outside of GOPATH: - - ``` - $ cd # e.g., cd ~/projects/hello - ``` - Note that outside of GOPATH, you do not need to set `GO111MODULE` to activate module mode. - - Alternatively, if you want to work in your GOPATH: - - ``` - $ export GO111MODULE=on # manually active module mode - $ cd $GOPATH/src/ # e.g., cd $GOPATH/src/you/hello - ``` - -2. Create the initial module definition and write it to the `go.mod` file: - - ``` - $ go mod init - ``` - This step converts from any existing [`dep`](https://github.com/golang/dep) `Gopkg.lock` file or any of the other [nine total supported dependency formats](https://tip.golang.org/pkg/cmd/go/internal/modconv/?m=all#pkg-variables), adding require statements to match the existing configuration. - - `go mod init` will often be able to use auxiliary data (such as VCS meta-data) to automatically determine the appropriate module path, but if `go mod init` states it can not automatically determine the module path, or if you need to otherwise override that path, you can supply the [module path](https://github.com/golang/go/wiki/Modules#gomod) as an optional argument to `go mod init`, for example: - - ``` - $ go mod init github.com/my/repo - ``` - - Note that if your dependencies include v2+ modules, or if you are initializing a v2+ module, then after running `go mod init` you might also need to edit your `go.mod` and `.go` code to add `/vN` to import paths and module paths as described in the ["Semantic Import Versioning"](https://github.com/golang/go/wiki/Modules#semantic-import-versioning) section above. This applies even if `go mod init` automatically converted your dependency information from `dep` or other dependency managers. (Because of this, after running `go mod init`, you typically should not run `go mod tidy` until you have successfully run `go build ./...` or similar, which is the sequence shown in this section). - -3. Build the module. When executed from the root directory of a module, the `./...` pattern matches all the packages within the current module. `go build` will automatically add missing or unconverted dependencies as needed to satisfy imports for this particular build invocation: - - ``` - $ go build ./... - ``` -4. Test the module as configured to ensure that it works with the selected versions: - - ``` - $ go test ./... - ``` - -5. (Optional) Run the tests for your module plus the tests for all direct and indirect dependencies to check for incompatibilities: - - ``` - $ go test all - ``` - -Prior to tagging a release, see the ["How to Prepare for a Release"](https://github.com/golang/go/wiki/Modules#how-to-prepare-for-a-release) section below. - -For more information on all of these topics, the primary entry point to the official modules documentation is [available on golang.org](https://pkg.go.dev/cmd/go/#hdr-Modules__module_versions__and_more). - -## How to Upgrade and Downgrade Dependencies - -Day-to-day upgrading and downgrading of dependencies should be done using 'go get', which will automatically update the `go.mod` file. Alternatively, you can edit `go.mod` directly. - -In addition, go commands like 'go build', 'go test', or even 'go list' will automatically add new dependencies as needed to satisfy imports (updating `go.mod` and downloading the new dependencies). - -To upgrade a dependency to the latest version: -``` -go get example.com/package -``` - -To upgrade a dependency *and all its dependencies* to the latest version: -``` -go get -u example.com/package -``` - -To view available minor and patch upgrades for all direct and indirect dependencies: - -``` -go list -u -m all -``` - -To view available minor and patch upgrades _only_ for the direct dependencies, run: -``` -go list -u -f '{{if (and (not (or .Main .Indirect)) .Update)}}{{.Path}}: {{.Version}} -> {{.Update.Version}}{{end}}' -m all 2> /dev/null -``` - -To upgrade to the latest version for all direct and indirect dependencies of the current module, the following can be run from the module root directory: - * `go get -u ./...` to use the latest *minor or patch* releases (and add `-t` to also upgrade test dependencies) - * `go get -u=patch ./...` to use the latest *patch* releases (and add `-t` to also upgrade test dependencies) - -`go get foo` updates to the latest version of `foo`. `go get foo` is equivalent to `go get foo@latest` — in other words, `@latest` is the default if no `@` version is specified. - -In this section, "latest" is the latest version with a [semver](https://semver.org/) tag, or the latest known commit if there are no semver tags. Prerelease tags are not selected as "latest" unless there are no other semver tags on the repository ([details](https://pkg.go.dev/cmd/go/#hdr-Module_aware_go_get)). - -A common mistake is thinking `go get -u foo` solely gets the latest version of `foo`. In actuality, the `-u` in `go get -u foo` or `go get -u foo@latest` means to _also_ get the latest versions for _all_ of the direct and indirect dependencies of `foo`. A common starting point when upgrading `foo` is instead to do `go get foo` or `go get foo@latest` without a `-u` (and after things are working, consider `go get -u=patch foo`, `go get -u=patch`, `go get -u foo`, or `go get -u`). - -To upgrade or downgrade to a more specific version, 'go get' allows version selection to be overridden by adding an @version suffix or ["module query"](https://pkg.go.dev/cmd/go/#hdr-Module_queries) to the package argument, such as `go get foo@v1.6.2`, `go get foo@e3702bed2`, or `go get foo@'= x.y.z of a dependency D (which may be specified due to incompatibilities with version < x.y.z of module D). Empirical data suggests [this is the dominant form of constraints used in `dep` and `cargo`](https://twitter.com/_rsc/status/1022590868967116800). In addition, the top-level module in the build can `exclude` specific versions of dependencies or `replace` other modules with different code. See the full proposal for [more details and rationale](https://github.com/golang/proposal/blob/master/design/24301-versioned-go.md). - -One of the key goals of the versioned modules proposal is to add a common vocabulary and semantics around versions of Go code for both tools and developers. This lays a foundation for future capabilities to declare additional forms of incompatibilities, such as possibly: -* declaring deprecated versions as [described](https://research.swtch.com/vgo-module) in the initial `vgo` blog series -* declaring pair-wise incompatibility between modules in an external system as discussed for example [here](https://github.com/golang/go/issues/24301#issuecomment-392111327) during the proposal process -* declaring pair-wise incompatible versions or insecure versions of a module after a release has been published. See for example the on-going discussion in [#24031](https://github.com/golang/go/issues/24031#issuecomment-407798552) and [#26829](https://github.com/golang/go/issues/26829) - -### When do I get old behavior vs. new module-based behavior? - -In general, modules are opt-in for Go 1.11, so by design old behavior is preserved by default. - -Summarizing when you get the old 1.10 status quo behavior vs. the new opt-in modules-based behavior: - -* Inside GOPATH — defaults to old 1.10 behavior (ignoring modules) -* Outside GOPATH while inside a file tree with a `go.mod` — defaults to modules behavior -* GO111MODULE environment variable: - * unset or `auto` — default behavior above - * `on` — force module support on regardless of directory location - * `off` — force module support off regardless of directory location - -### Why does installing a tool via `go get` fail with error `cannot find main module`? - -This occurs when you have set `GO111MODULE=on`, but are not inside of a file tree with a `go.mod` when you run `go get`. - -The simplest solution is to leave `GO111MODULE` unset (or equivalently explicitly set to `GO111MODULE=auto`), which avoids this error. - -Recall one of the primary reason modules exist is to record precise dependency information. This dependency information is written to your current `go.mod`. If you are not inside of a file tree with a `go.mod` but you have told the `go get` command to operate in module mode by setting `GO111MODULE=on`, then running `go get` will result in the error `cannot find main module` because there is no `go.mod` available to record dependency information. - -Solution alternatives include: - -1. Leave `GO111MODULE` unset (the default, or explicitly set `GO111MODULE=auto`), which results in friendlier behavior. This will give you Go 1.10 behavior when you are outside of a module and hence will avoid `go get` reporting `cannot find main module`. - -2. Leave `GO111MODULE=on`, but as needed disable modules temporarily and enable Go 1.10 behavior during `go get`, such as via `GO111MODULE=off go get example.com/cmd`. This can be turned into a simple script or shell alias such as `alias oldget='GO111MODULE=off go get'` - -3. Create a temporary `go.mod` file that is then discarded. This has been automated by a [simple shell script](https://gist.github.com/rogpeppe/7de05eef4dd774056e9cf175d8e6a168) by [@rogpeppe](https://github.com/rogpeppe). This script allows version information to optionally be supplied via `vgoget example.com/cmd[@version]`. (This can be a solution for avoiding the error `cannot use path@version syntax in GOPATH mode`). - -4. `gobin` is a module-aware command to install and run main packages. By default, `gobin` installs/runs main packages without first needing to manually create a module, but with the `-m` flag it can be told to use an existing module to resolve dependencies. Please see the `gobin` [README](https://github.com/myitcv/gobin#usage) and [FAQ](https://github.com/myitcv/gobin/wiki/FAQ) for details and additional use cases. - -5. Create a `go.mod` you use to track your globally installed tools, such as in `~/global-tools/go.mod`, and `cd` to that directory prior to running `go get` or `go install` for any globally installed tools. - -6. Create a `go.mod` for each tool in separate directories, such as `~/tools/gorename/go.mod` and `~/tools/goimports/go.mod`, and `cd` to that appropriate directory prior to running `go get` or `go install` for the tool. - -This current limitation will be resolved. However, the primary issue is that modules are currently opt-in, and a full solution will likely wait until GO111MODULE=on becomes the default behavior. See [#24250](https://github.com/golang/go/issues/24250#issuecomment-377553022) for more discussion, including this comment: - -> This clearly must work eventually. The thing I'm not sure about is exactly what this does as far as the version is concerned: does it create a temporary module root and go.mod, do the install, and then throw it away? Probably. But I'm not completely sure, and for now, I didn't want to confuse people by making vgo do things outside go.mod trees. Certainly, the eventual go command integration has to support this. - -This FAQ has been discussing tracking _globally_ installed tools. - -If instead, you want to track the tools required by a _specific_ module, see the next FAQ. - -### How can I track tool dependencies for a module? - -If you: - * want to use a go-based tool (e.g. `stringer`) while working on a module, and - * want to ensure that everyone is using the same version of that tool while tracking the tool's version in your module's `go.mod` file - -then one currently recommended approach is to add a `tools.go` file to your module that includes import statements for the tools of interest (such as `import _ "golang.org/x/tools/cmd/stringer"`), along with a `//go:build tools` build constraint. The import statements allow the `go` command to precisely record the version information for your tools in your module's `go.mod`, while the `//go:build tools` build constraint prevents your normal builds from actually importing your tools. - -For a concrete example of how to do this, please see this ["Go Modules by Example" walkthrough](https://github.com/go-modules-by-example/index/blob/master/010_tools/README.md). - -A discussion of the approach along with an earlier concrete example of how to do this is in [this comment in #25922](https://github.com/golang/go/issues/25922#issuecomment-412992431). - -The brief rationale (also from [#25922](https://github.com/golang/go/issues/25922#issuecomment-402918061)): - -> I think the tools.go file is, in fact, the best practice for tool dependencies, certainly for Go 1.11. -> -> I like it because it does not introduce new mechanisms. -> -> It simply reuses existing ones. - -You can also (since go 1.16) use `go install tool@version`, which will install a specific version, or (since go 1.17) `go run tool@version`, which will run the tool without installing, as implemented in [#42088](https://github.com/golang/go/issues/42088) and [#40276](https://github.com/golang/go/issues/40276), which can eliminate the need for tools.go. - -### What is the status of module support in IDEs, editors and standard tools like goimports, gorename, etc? - -Support for modules is starting to land in editors and IDEs. - -For example: -* **GoLand**: currently has full support for modules outside and inside GOPATH, including completion, syntax analysis, refactoring, navigation as described [here](https://blog.jetbrains.com/go/2018/08/24/goland-2018-2-2-is-here/). -* **VS Code**: work is complete, MS recommending modules over GOPATH, the former tracking issue ([#1532](https://github.com/Microsoft/vscode-go/issues/1532)) has been closed. Documentation is available in the [VS Code module repository](https://github.com/golang/vscode-go). -* **Atom with go-plus**: tracking issue is [#761](https://github.com/joefitzgerald/go-plus/issues/761). -* **vim with vim-go**: initial support for syntax highlighting and formatting `go.mod` has [landed](https://github.com/fatih/vim-go/pull/1931). Broader support tracked in [#1906](https://github.com/fatih/vim-go/issues/1906). -* **emacs with go-mode.el**: tracking issue in [#237](https://github.com/dominikh/go-mode.el/issues/237). - -The status of other tools such as goimports, guru, gorename and similar tools is being tracked in an umbrella issue [#24661]( https://github.com/golang/go/issues/24661). Please see that umbrella issue for latest status. - -Some tracking issues for particular tools include: -* **gocode**: tracking issue in [mdempsky/gocode/#46](https://github.com/mdempsky/gocode/issues/46). Note that `nsf/gocode` is recommending people migrate off of `nsf/gocode` to `mdempsky/gocode`. -* **go-tools** (tools by dominikh such as staticcheck, megacheck, gosimple): sample tracking issue [dominikh/go-tools#328](https://github.com/dominikh/go-tools/issues/328). - -In general, even if your editor, IDE or other tools have not yet been made module aware, much of their functionality should work with modules if you are using modules inside GOPATH and do `go mod vendor` (because then the proper dependencies should be picked up via GOPATH). - -The full fix is to move programs that load packages off of `go/build` and onto `golang.org/x/tools/go/packages`, which understands how to locate packages in a module-aware manner. This will likely eventually become `go/packages`. - -## FAQs — Additional Control - -### What community tooling exists for working with modules? - -The community is starting to build tooling on top of modules. For example: - -* [github.com/rogpeppe/gohack](https://github.com/rogpeppe/gohack) - * A new community tool to automate and greatly simplify `replace` and multi-module workflows, including allowing you to easily modify one of your dependencies - * For example, `gohack example.com/some/dependency` automatically clones the appropriate repository and adds the necessary `replace` directives to your `go.mod` - * Remove all gohack replace statements with `gohack undo` - * The project is continuing to expand to make other module-related workflows easier -* [github.com/marwan-at-work/mod](https://github.com/marwan-at-work/mod) - * Command line tool to automatically upgrade/downgrade major versions for modules - * Automatically adjusts `go.mod` files and related import statements in go source code - * Helps with upgrades, or when first opting into modules with a v2+ package -* [github.com/akyoto/mgit](https://github.com/akyoto/mgit) - * Lets you view & control semver tags of all of your local projects - * Shows untagged commits and lets you tag them all at once (`mgit -tag +0.0.1`) -* [github.com/goware/modvendor](https://github.com/goware/modvendor) - * Helps copy additional files into the `vendor/` folder, such as shell scripts, .cpp files, .proto files, etc. -* [github.com/psampaz/go-mod-outdated](https://github.com/psampaz/go-mod-outdated) - * Displays outdated dependencies in a human friendly way - * Provides a way to filter indirect dependencies and dependencies without updates - * Provides a way to break CI pipelines in case of outdated dependencies -* [github.com/oligot/go-mod-upgrade](https://github.com/oligot/go-mod-upgrade) - * Update outdated Go dependencies interactively - -### When should I use the replace directive? - -As described in the ['go.mod' concepts section above](https://github.com/golang/go/wiki/Modules#gomod), `replace` directives provide additional control in the top-level `go.mod` for what is actually used to satisfy a dependency found in the Go source or go.mod files, while `replace` directives in modules other than the main module are ignored when building the main module. - -The `replace` directive allows you to supply another import path that might be another module located in VCS (GitHub or elsewhere), or on your local filesystem with a relative or absolute file path. The new import path from the `replace` directive is used without needing to update the import paths in the actual source code. - - `replace` allows the top-level module control over the exact version used for a dependency, such as: - * `replace example.com/some/dependency => example.com/some/dependency v1.2.3` - -`replace` also allows the use of a forked dependency, such as: - * `replace example.com/some/dependency => example.com/some/dependency-fork v1.2.3` - -You can also reference branches, for example: - * `replace example.com/some/dependency => example.com/some/dependency-fork master` - -One sample use case is if you need to fix or investigate something in a dependency, you can have a local fork and add something like the following in your top-level `go.mod`: - * `replace example.com/original/import/path => /your/forked/import/path` - -`replace` also can be used to inform the go tooling of the relative or absolute on-disk location of modules in a multi-module project, such as: - * `replace example.com/project/foo => ../foo` - -**Note**: if the right-hand side of a `replace` directive is a filesystem path, then the target must have a `go.mod` file at that location. If the `go.mod` file is not present, you can create one with `go mod init`. - -In general, you have the option of specifying a version to the left of the `=>` in a replace directive, but typically it is less sensitive to change if you omit that (e.g., as done in all of the `replace` examples above). - -A `require` directive is needed for each `replace` directive of a direct dependency. When replacing a dependency from a filesystem path, the version of the corresponding require directive is essentially ignored; in this case, the pseudoversion `v0.0.0` is a good choice to make this clear, e.g. `require example.com/module v0.0.0`. - -You can confirm you are getting your expected versions by running `go list -m all`, which shows you the actual final versions that will be used in your build including taking into account `replace` statements. - -See the ['go mod edit' documentation](https://pkg.go.dev/cmd/go/#hdr-Edit_go_mod_from_tools_or_scripts) for more details. - -[github.com/rogpeppe/gohack](https://github.com/rogpeppe/gohack) makes these types of workflows much easier, especially if your goal is to have mutable checkouts of dependencies of a module. See the [repository](https://github.com/rogpeppe/gohack) or the immediately prior FAQ for an overview. - -See the next FAQ for the details of using `replace` to work entirely outside of VCS. - -### Can I work entirely outside of VCS on my local filesystem? - -Yes. VCS is not required. - -This is very simple if you have a single module you want to edit at a time outside of VCS (and you either have only one module in total, or if the other modules reside in VCS). In this case, you can place the file tree containing the single `go.mod` in a convenient location. Your `go build`, `go test` and similar commands will work even if your single module is outside of VCS (without requiring any use of `replace` in your `go.mod`). - -If you want to have multiple inter-related modules on your local disk that you want to edit at the same time, then `replace` directives are one approach. Here is a sample `go.mod` that uses a `replace` with a relative path to point the `hello` module at the on-disk location of the `goodbye` module (without relying on any VCS): - -``` -module example.com/me/hello - -require ( - example.com/me/goodbye v0.0.0 -) - -replace example.com/me/goodbye => ../goodbye -``` - -A small runnable example is shown in this [thread](https://groups.google.com/d/msg/golang-nuts/1nYoAMFZVVM/eppaRW2rCAAJ). - -### How do I use vendoring with modules? Is vendoring going away? - -The initial series of `vgo` blog posts did propose dropping vendoring entirely, but [feedback](https://groups.google.com/d/msg/golang-dev/FTMScX1fsYk/uEUSjBAHAwAJ) from the community resulted in retaining support for vendoring. - -In brief, to use vendoring with modules: -* `go mod vendor` resets the main module's vendor directory to include all packages needed to build and test all of the module's packages based on the state of the go.mod files and Go source code. -* By default, go commands like `go build` ignore the vendor directory when in module mode. -* The `-mod=vendor` flag (e.g., `go build -mod=vendor`) instructs the go commands to use the main module's top-level vendor directory to satisfy dependencies. The go commands in this mode therefore ignore the dependency descriptions in go.mod and assume that the vendor directory holds the correct copies of dependencies. Note that only the main module's top-level vendor directory is used; vendor directories in other locations are still ignored. -* Some people will want to routinely opt-in to vendoring by setting a `GOFLAGS=-mod=vendor` environment variable. - -Older versions of Go such as 1.10 understand how to consume a vendor directory created by `go mod vendor`, as do Go 1.11 and 1.12+ when [module mode](https://github.com/golang/go/wiki/Modules#when-do-i-get-old-behavior-vs-new-module-based-behavior) is disabled. Therefore, vendoring is one way for a module to provide dependencies to older versions of Go that do not fully understand modules, as well as to consumers that have not enabled modules themselves. - -If you are considering using vendoring, it is worthwhile to read the ["Modules and vendoring"](https://tip.golang.org/cmd/go/#hdr-Modules_and_vendoring) and ["Make vendored copy of dependencies"](https://tip.golang.org/cmd/go/#hdr-Make_vendored_copy_of_dependencies) sections of the tip documentation. - -### Are there "always on" module repositories and enterprise proxies? - -Publicly hosted "always on" immutable module repositories and optional privately hosted proxies and repositories are becoming available. - -For example: -* [proxy.golang.org](https://proxy.golang.org) - Official project - Run by [Google](https://www.google.com) - The default Go module proxy built by the Go team. -* [proxy.golang.com.cn](https://proxy.golang.com.cn) - China proxy project - Run by [China Golang Contributor Club](https://golangcn.org) - China Go module proxy. -* [mirrors.tencent.com/go](https://mirrors.tencent.com/go/) - Commercial project - Run by [Tencent Cloud](https://cloud.tencent.com/) - A Go module proxy alternate. -* [mirrors.aliyun.com/goproxy](https://mirrors.aliyun.com/goproxy) - Commercial project - Run by [Alibaba Cloud](https://www.alibabacloud.com) - A Go module proxy alternate. -* [goproxy.cn](https://goproxy.cn) - Open source project - Run by [Qiniu Cloud](https://www.qiniu.com) - The most trusted Go module proxy in China. -* [goproxy.io](https://goproxy.io) - Open source project - Run by [China Golang Contributor Club](https://golangcn.org) - A global proxy for Go modules. -* [Athens](https://github.com/gomods/athens) - Open source project - Self-hosted - A Go module datastore and proxy. -* [athens.azurefd.net](https://athens.azurefd.net) - Open source project - A hosted module proxy running Athens. -* [Goproxy](https://github.com/goproxy/goproxy) - Open source project - Self-hosted - A minimalist Go module proxy handler. -* [THUMBAI](https://thumbai.app) - Open source project - Self-hosted - Go mod proxy server and Go vanity import path server. - -Note that you are not required to run a proxy. Rather, the go tooling in 1.11 has added optional proxy support via [GOPROXY](https://tip.golang.org/cmd/go/#hdr-Module_proxy_protocol) to enable more enterprise use cases (such as greater control), and also to better handle situations such as "GitHub is down" or people deleting GitHub repositories. - -### Can I control when go.mod gets updated and when the go tools use the network to satisfy dependencies? - -By default, a command like `go build` will reach out to the network as needed to satisfy imports. - -Some teams will want to disallow the go tooling from touching the network at certain points, or will want greater control regarding when the go tooling updates `go.mod`, how dependencies are obtained, and how vendoring is used. - -The go tooling provides a fair amount of flexibility to adjust or disable these default behaviors, including via `-mod=readonly`, `-mod=vendor`, `GOFLAGS`, `GOPROXY=off`, `GOPROXY=file:///filesystem/path`, `go mod vendor`, and `go mod download`. - -The details on these options are spread throughout the official documentation. One community attempt at a consolidated overview of knobs related to these behaviors is [here](https://github.com/thepudds/go-module-knobs/blob/master/README.md), which includes links to the official documentation for more information. - -### How do I use modules with CI systems such as Travis or CircleCI? - -The simplest approach is likely just setting the environment variable `GO111MODULE=on`, which should work with most CI systems. - -However, it can be valuable to run tests in CI on Go 1.11 with modules enabled as well as disabled, given some of your users will not have yet opted in to modules themselves. Vendoring is also a topic to consider. - -The following two blog posts cover these topics more concretely: - -* ["Using Go modules with vendor support on Travis CI"](https://arslan.io/2018/08/26/using-go-modules-with-vendor-support-on-travis-ci/) by Fatih Arslan -* ["Go Modules and CircleCI"](https://medium.com/@toddkeech/go-modules-and-circleci-c0d6fac0b000) by Todd Keech - -### How do I download modules needed to build specific packages or tests? - -The `go mod download` command (or equivalently, `go mod download all`) downloads all modules in the build list (as reported by `go list -m all`). Many of these modules aren't needed to build packages in the main module, since the full build list contains things like test dependencies and tool dependencies for other modules. Consequently, Docker images prepared with `go mod download` may be larger than necessary. - -Instead, consider using `go list`. For example, `go list ./...` will download the modules needed to build the packages `./...` (the set of packages in the main module, when run from the module root directory). - -To download test dependencies as well, use `go list -test ./...`. - -By default, `go list` will only consider dependencies needed for the current platform. You can set `GOOS` and `GOARCH` to make `go list` consider another platform, for example, `GOOS=linux GOARCH=amd64 go list ./...`. The `-tags` flag may also be used to select packages with specific build tags. - -This technique may be less necessary in the future when lazy module loading is implemented (see [#36460](https://github.com/golang/go/issues/36460)), since the module pattern `all` will include fewer modules. - -## FAQs — go.mod and go.sum - -### Why does 'go mod tidy' record indirect and test dependencies in my 'go.mod'? - -The modules system records precise dependency requirements in your `go.mod`. (For more details, see the [go.mod concepts](https://github.com/golang/go/wiki/Modules#gomod) section above or the [go.mod tip documentation](https://tip.golang.org/cmd/go/#hdr-The_go_mod_file)). - -`go mod tidy` updates your current `go.mod` to include the dependencies needed for tests in your module — if a test fails, we must know which dependencies were used in order to reproduce the failure. - -`go mod tidy` also ensures your current `go.mod` reflects the dependency requirements for all possible combinations of OS, architecture, and build tags (as described [here](https://github.com/golang/go/issues/25971#issuecomment-399091682)). In contrast, other commands like `go build` and `go test` only update `go.mod` to provide the packages imported by the requested packages under the current `GOOS`, `GOARCH`, and build tags (which is one reason `go mod tidy` might add requirements that were not added by `go build` or similar). - -If a dependency of your module does not itself have a `go.mod` (e.g., because the dependency has not yet opted in to modules itself), or if its `go.mod` file is missing one or more of its dependencies (e.g., because the module author did not run `go mod tidy`), then the missing transitive dependencies will be added to _your_ module's requirements, along with an `// indirect` comment to indicate that the dependency is not from a direct import within your module. - -Note that this also means that any missing test dependencies from your direct or indirect dependencies will also be recorded in your `go.mod`. (An example of when this is important: `go test all` runs the tests of _all_ direct and indirect dependencies of your module, which is one way to validate that your current combination of versions work together. If a test fails in one of your dependencies when you run `go test all`, it is important to have a complete set of test dependency information recorded so that you have reproducible `go test all` behavior). - -Another reason you might have `// indirect` dependencies in your `go.mod` file is if you have upgraded (or downgraded) one of your indirect dependencies beyond what is required by your direct dependencies, such as if you ran `go get -u` or `go get foo@1.2.3`. The go tooling needs a place to record those new versions, and it does so in your `go.mod` file (and it does not reach down into your dependencies to modify _their_ `go.mod` files). - -In general, the behaviors described above are part of how modules provide 100% reproducible builds and tests by recording precise dependency information. - -If you are curious as to why a particular module is showing up in your `go.mod`, you can run `go mod why -m ` to [answer](https://tip.golang.org/cmd/go/#hdr-Explain_why_packages_or_modules_are_needed) that question. Other useful tools for inspecting requirements and versions include `go mod graph` and `go list -m all`. - -### Is 'go.sum' a lock file? Why does 'go.sum' include information for module versions I am no longer using? - -No, `go.sum` is not a lock file. The `go.mod` files in a build provide enough information for 100% reproducible builds. - -For validation purposes, `go.sum` contains the expected cryptographic checksums of the content of specific module versions. See the [FAQ below](https://github.com/golang/go/wiki/Modules#should-i-commit-my-gosum-file-as-well-as-my-gomod-file) for more details on `go.sum` (including why you typically should check in `go.sum`) as well as the ["Module downloading and verification"](https://tip.golang.org/cmd/go/#hdr-Module_downloading_and_verification) section in the tip documentation. - -In addition, your module's `go.sum` records checksums for all direct and indirect dependencies used in a build (and hence your `go.sum` will frequently have more modules listed than your `go.mod`). - -### Should I commit my 'go.sum' file as well as my 'go.mod' file? - -Typically your module's `go.sum` file should be committed along with your `go.mod` file. - -* `go.sum` contains the expected cryptographic checksums of the content of specific module versions. -* If someone clones your repository and downloads your dependencies using the go command, they will receive an error if there is any mismatch between their downloaded copies of your dependencies and the corresponding entries in your `go.sum`. -* In addition, `go mod verify` checks that the on-disk cached copies of module downloads still match the entries in `go.sum`. -* Note that `go.sum` is not a lock file as used in some alternative dependency management systems. (`go.mod` provides enough information for reproducible builds). -* See very brief [rationale here](https://twitter.com/FiloSottile/status/1029404663358087173) from Filippo Valsorda on why you should check in your `go.sum`. See the ["Module downloading and verification"](https://tip.golang.org/cmd/go/#hdr-Module_downloading_and_verification) section of the tip documentation for more details. See possible future extensions being discussed for example in [#24117](https://github.com/golang/go/issues/24117) and [#25530](https://github.com/golang/go/issues/25530). - -### Should I still add a 'go.mod' file if I do not have any dependencies? - -Yes. This supports working outside of GOPATH, helps communicate to the ecosystem that you are opting in to modules, and in addition the `module` directive in your `go.mod` serves as a definitive declaration of the identity of your code (which is one reason why import comments might eventually be deprecated). Of course, modules are purely an opt-in capability in Go 1.11. - -## FAQs — Semantic Import Versioning - -### Why must major version numbers appear in import paths? - -Please see the discussion on the Semantic Import Versioning and the import compatibility rule in the ["Semantic Import Versioning"](https://github.com/golang/go/wiki/Modules#semantic-import-versioning) concepts section above. See also the [blog post announcing the proposal](https://go.dev/blog/versioning-proposal), which talks more about the motivation and justification for the import compatibility rule. - -### Why are major versions v0, v1 omitted from import paths?" - -Please see the question "Why are major versions v0, v1 omitted from import paths?" in the earlier [FAQ from the official proposal discussion](https://github.com/golang/go/issues/24301#issuecomment-371228664). - -### What are some implications of tagging my project with major version v0, v1, or making breaking changes with v2+? - -In response to a comment about *"k8s does minor releases but changes the Go API in each minor release"*, Russ Cox made the following [response](https://github.com/kubernetes/kubernetes/pull/65683#issuecomment-403705882) that highlights some implications for picking v0, v1, vs. frequently making breaking changes with v2, v3, v4, etc. with your project: - -> I don't fully understand the k8s dev cycle etc, but I think generally the k8s team needs to decide/confirm what they intend to guarantee to users about stability and then apply version numbers accordingly to express that. -> -> * To make a promise about API compatibility (which seems like the best user experience!) then start doing that and use 1.X.Y. -> * To have the flexibility to make backwards-incompatible changes in every release but allow different parts of a large program to upgrade their code on different schedules, meaning different parts can use different major versions of the API in one program, then use X.Y.0, along with import paths like k8s.io/client/vX/foo. -> * To make no promises about API compatible and also require every build to have only one copy of the k8s libraries no matter what, with the implied forcing of all parts of a build to use the same version even if not all of them are ready for it, then use 0.X.Y. - -On a related note, Kubernetes has some atypical build approaches (currently including custom wrapper scripts on top of godep), and hence Kubernetes is an imperfect example for many other projects, but it will likely be an interesting example as [Kubernetes moves towards adopting Go 1.11 modules](https://github.com/kubernetes/kubernetes/pull/64731#issuecomment-407345841). - -### Can a module consume a package that has not opted in to modules? - -Yes. - -If a repository has not opted in to modules but has been tagged with valid [semver](https://semver.org) tags (including the required leading `v`), then those semver tags can be used in a `go get`, and a corresponding semver version will be record in the importing module's `go.mod` file. If the repository does not have any valid semver tags, then the repository's version will be recorded with a ["pseudo-version"](https://pkg.go.dev/cmd/go/#hdr-Pseudo_versions) such as ` v0.0.0-20171006230638-a6e239ea1c69` (which includes a timestamp and a commit hash, and which are designed to allow a total ordering across versions recorded in `go.mod` and to make it easier to reason about which recorded versions are "later" than another recorded version). - -For example, if the latest version of package `foo` is tagged `v1.2.3` but `foo` has not itself opted in to modules, then running `go get foo` or `go get foo@v1.2.3` from inside module M will be recorded in module M's `go.mod` file as: - -``` -require foo v1.2.3 -``` - -The `go` tool will also use available semver tags for a non-module package in additional workflows (such as `go list -u=patch`, which upgrades the dependencies of a module to available patch releases, or `go list -u -m all`, which shows available upgrades, etc.). - -Please see the next FAQs for additional details related to v2+ packages that have not opted in to modules. - -### Can a module consume a v2+ package that has not opted into modules? What does '+incompatible' mean? - -Yes, a module can import a v2+ package that has not opted into modules, and if the imported v2+ package has a valid [semver](https://semver.org) tag, it will be recorded with a `+incompatible` suffix. - -**Additional Details** - -Please be familiar with the material in the ["Semantic Import Versioning"](https://github.com/golang/go/wiki/Modules#semantic-import-versioning) section above. - -It is helpful to first review some core principles that are generally useful but particularly important to keep in mind when thinking about the behavior described in this FAQ. - -The following core principles are _always_ true when the `go` tool is operating in module mode (e.g., `GO111MODULE=on`): - -1. A package's import path defines the identity of the package. - * Packages with _different_ import paths are treated as _different_ packages. - * Packages with the _same_ import path are treated as the _same_ package (and this is true _even if_ the VCS tags say the packages have different major versions). -2. An import path without a `/vN` is treated as a v1 or v0 module (and this is true _even if_ the imported package has not opted in to modules and has VCS tags that say the major version is greater than 1). -3. The module path (such as `module foo/v2`) declared at the start of a module's `go.mod` file is both: - * the definitive declaration of that module's identity - * the definitive declaration of how that module must be imported by consuming code - -As we will see in the next FAQ, these principles are not always true when the `go` tool is _not_ in module mode, but these principles are always true when the `go` tool _is_ in module mode. - -In short, the `+incompatible` suffix indicates that principle 2 above is in effect when the following are true: -* an imported package has not opted in to modules, and -* its VCS tags say the major version is greater than 1, and -* principle 2 is overriding the VCS tags – the import path without a `/vN` is treated as a v1 or v0 module (even though the VCS tags say otherwise) - -When the `go` tool is in module mode, it will assume a non-module v2+ package has no awareness of Semantic Import Versioning and treat it as an (incompatible) extension of the v1 version series of the package (and the `+incompatible` suffix is an indication that the `go` tool is doing so). - -**Example** - -Suppose: -* `oldpackage` is a package that predates the introduction of modules -* `oldpackage` has never opted in to modules (and hence does not have a `go.mod` itself) -* `oldpackage` has a valid semver tag `v3.0.1`, which is its latest tag - -In this case, running for example `go get oldpackage@latest` from inside module M will record the following in module M's `go.mod` file: - -``` -require oldpackage v3.0.1+incompatible -``` - -Note that there is no `/v3` used at the end of `oldpackage` in the `go get` command above or in the recorded `require` directive – using `/vN` in module paths and import paths is a feature of [Semantic Import Versioning](https://github.com/golang/go/wiki/Modules#semantic-import-versioning), and `oldpackage` has not signaled its acceptance and understanding of Semantic Import Versioning given `oldpackage` has not opted into modules by having a `go.mod` file within `oldpackage` itself. In other words, even though `oldpackage` has a [semver](https://semver.org) tag of `v3.0.1`, `oldpackage` is not granted the rights and responsibilities of [Semantic Import Versioning](https://github.com/golang/go/wiki/Modules#semantic-import-versioning) (such as using `/vN` in import paths) because `oldpackage` has not yet stated its desire to do so. - -The `+incompatible` suffix indicates that the `v3.0.1` version of `oldpackage` has not actively opted in to modules, and hence the `v3.0.1` version of `oldpackage` is assumed to _not_ understand Semantic Import Versioning or how to use major versions in import paths. Therefore, when operating in [module mode](https://github.com/golang/go/wiki/Modules#when-do-i-get-old-behavior-vs-new-module-based-behavior), the `go` tool will treat the non-module `v3.0.1` version of `oldpackage` as an (incompatible) extension of the v1 version series of `oldpackage` and assume that the `v3.0.1` version of `oldpackage` has no awareness of Semantic Import Versioning, and the `+incompatible` suffix is an indication that the `go` tool is doing so. - -The fact that the `v3.0.1` version of `oldpackage` is considered to be part of the v1 release series according to Semantic Import Versioning means for example that versions `v1.0.0`, `v2.0.0`, and `v3.0.1` are all always imported using the same import path: - -``` -import "oldpackage" -``` - -Note again that there is no `/v3` used at the end of `oldpackage`. - -In general, packages with different import paths are different packages. In this example, given versions `v1.0.0`, `v2.0.0`, and `v3.0.1` of `oldpackage` would all be imported using the same import path, they are therefore treated by a build as the same package (again because `oldpackage` has not yet opted in to Semantic Import Versioning), with a single copy of `oldpackage` ending up in any given build. (The version used will be the semantically highest of the versions listed in any `require` directives; see ["Version Selection"](https://github.com/golang/go/wiki/Modules#version-selection)). - -If we suppose that later a new `v4.0.0` release of `oldpackage` is created that adopts modules and hence contains a `go.mod` file, that is the signal that `oldpackage` now understands the rights and responsibilities of Semantic Import Versioning, and hence a module-based consumer would now import using `/v4` in the import path: - -``` -import "oldpackage/v4" -``` - -and the version would be recorded as: - -``` -require oldpackage/v4 v4.0.0 -``` - -`oldpackage/v4` is now a different import path than `oldpackage`, and hence a different package. Two copies (one for each import path) would end up in a module-aware build if some consumers in the build have `import "oldpackage/v4"` while other consumers in the same build have `import "oldpackage"`. This is desirable as part of the strategy to allow gradual adoption of modules. In addition, even after modules are out of their current transitional phase, this behavior is also desirable to allow gradual code evolution over time with different consumers upgrading at different rates to newer versions (e.g., allowing different consumers in a large build to choose to upgrade at different rates from `oldpackage/v4` to some future `oldpackage/v5`). - -### How are v2+ modules treated in a build if modules support is not enabled? How does "minimal module compatibility" work in 1.9.7+, 1.10.3+, and 1.11? - -When considering older Go versions or Go code that has not yet opted in to modules, Semantic Import Versioning has significant backwards-compatibility implications related to v2+ modules. - -As described in the ["Semantic Import Versioning"](https://github.com/golang/go/wiki/Modules#semantic-import-versioning) section above: -* a module that is version v2 or higher must include a `/vN` in its own module path declared in its `go.mod`. -* a module-based consumer (that is, code that has opted in to modules) must include a `/vN` in the import path to import a v2+ module. - -However, the ecosystem is expected to proceed at varying paces of adoption for modules and Semantic Import Versioning. - -As described in more detail in the ["How to Release a v2+ Module"](https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher) section, in the "Major Subdirectory" approach, the author of a v2+ module creates subdirectories such as `mymodule/v2` or `mymodule/v3` and moves or copies the approriate packages underneath those subdirectories. This means the traditional import path logic (even in older Go releases such as Go 1.8 or 1.7) will find the appropriate packages upon seeing an import statement such as `import "mymodule/v2/mypkg"`. Hence, packages residing in a "Major Subdirectory" v2+ module will be found and used even if modules support is not enabled (whether that is because you are running Go 1.11 and have not enabled modules, or because you are running a older version like Go 1.7, 1.8, 1.9 or 1.10 that does not have full module support). Please see the ["How to Release a v2+ Module"](https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher) section for more details on the "Major Subdirectory" approach. - -The remainder of this FAQ is focused on the "Major Branch" approach described in the ["How to Release a v2+ Module"](https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher) section. In the "Major Branch" approach, no `/vN` subdirectories are created and instead the module version information is communicated by the `go.mod` file and by applying semver tags to commits (which often will be on `master`, but could be on different branches). - -In order to help during the current transitional period, "minimal module compatibility" was [introduced](https://go-review.googlesource.com/c/go/+/109340) to Go 1.11 to provide greater compatibility for Go code that has not yet opted in to modules, and that "minimal module compatibility" was also backported to Go 1.9.7 and 1.10.3 (where those versions are effectively always operating with full module mode disabled given those older Go versions do not have full module support). - -The primary goals of "minimal module compatibility" are: - -1. Allow older Go versions 1.9.7+ and 1.10.3+ to be able to more easily compile modules that are using Semantic Import Versioning with `/vN` in import paths, and provide that same behavior when [module mode](https://github.com/golang/go/wiki/Modules#when-do-i-get-old-behavior-vs-new-module-based-behavior) is disabled in Go 1.11. - -2. Allow old code to be able to consume a v2+ module without requiring that old consumer code to immediately change to using a new `/vN` import path when consuming a v2+ module. - -3. Do so without relying on the module author to create `/vN` subdirectories. - -**Additional Details – "Minimal Module Compatibility"** - -"Minimal module compatibility" only takes effect when full [module mode](https://github.com/golang/go/wiki/Modules#when-do-i-get-old-behavior-vs-new-module-based-behavior) is disabled for the `go` tool, such as if you have set `GO111MODULE=off` in Go 1.11, or are using Go versions 1.9.7+ or 1.10.3+. - -When a v2+ module author has _not_ created `/v2` or `/vN` subdirectories and you are instead relying on the "minimal module compatibility" mechanism in Go 1.9.7+, 1.10.3+ and 1.11: - -* A package that has _not_ opted in to modules would _not_ include the major version in the import path for any imported v2+ modules. -* In contrast, a package that _has_ opted in to modules _must_ include the major version in the import path to import any v2+ modules. - * If a package has opted in to modules, but does not include the major version in the import path when importing a v2+ modules, it will not import a v2+ version of that module when the `go` tool is operating in full module mode. (A package that has opted in to modules is assumed to "speak" Semantic Import Versioning. If `foo` is a module with v2+ versions, then under Semantic Import Versioning saying `import "foo"` means import the v1 Semantic Import Versioning series of `foo`). -* The mechanism used to implement "minimal module compatibility" is intentionally very narrow: - * The entirety of the logic is – when operating in GOPATH mode, an unresolvable import statement containing a `/vN` will be tried again after removing the `/vN` if the import statement is inside code that has opted in to modules (that is, import statements in `.go` files within a tree with a valid `go.mod` file). - * The net effect is that an import statement such as `import "foo/v2"` within code that lives inside of a module will still compile correctly in GOPATH mode in 1.9.7+, 1.10.3+ and 1.11, and it will resolve as if it said `import "foo"` (without the `/v2`), which means it will use the version of `foo` that resides in your GOPATH without being confused by the extra `/v2`. - * "Minimal module compatibility" does not affect anything else, including it does not the affect paths used in the `go` command line (such as arguments to `go get` or `go list`). -* This transitional "minimal module awareness" mechanism purposefully breaks the rule of "packages with different import paths are treated as different packages" in pursuit a very specific backwards-compatibility goal – to allow old code to compile unmodified when it is consuming a v2+ module. In slightly more detail: - * It would be a more burdensome for the overall ecosystem if the only way for old code to consume a v2+ module was to first change the old code. - * If we are not modifying old code, then that old code must work with pre-module import paths for v2+ modules. - * On the other hand, new or updated code opting in to modules must use the new `/vN` import for v2+ modules. - * The new import path is not equal to old import path, yet both are allowed to work in a single build, and therefore we have two different functioning import paths that resolve to the same package. - * For example, when operating in GOPATH mode, `import "foo/v2"` appearing in module-based code resolves to the same code residing in your GOPATH as `import "foo"`, and the build ends up with one copy of `foo` – in particular, whatever version is on disk in GOPATH. This allows module-based code with `import "foo/v2"` to compile even in GOPATH mode in 1.9.7+, 1.10.3+ and 1.11. -* In contrast, when the `go` tool is operating in full module mode: - * There are no exceptions to the rule "packages with different import paths are different packages" (including vendoring has been refined in full module mode to also adhere to this rule). - * For example, if the `go` tool is in full module mode and `foo` is a v2+ module, then `import "foo"` is asking for a v1 version of `foo` vs. `import "foo/v2"` is asking for a v2 version of `foo`. - -### What happens if I create a go.mod but do not apply semver tags to my repository? - -[semver](https://semver.org) is a foundation of the modules system. In order to provide the best experience for consumers, module authors are encouraged to apply semver VCS tags (e.g., `v0.1.0` or `v1.2.3-rc.1`), but semver VCS tags are not strictly required: - -1. Modules are required to follow the _semver specification_ in order for the `go` command to behave as documented. This includes following the semver specification regarding how and when breaking changes are allowed. - -2. Modules that do not have semver _VCS tags_ are recorded by consumers using a semver version in the form of a [pseudo-version](https://tip.golang.org/cmd/go/#hdr-Pseudo_versions). Typically this will be a v0 major version, unless the module author constructed a v2+ module following the ["Major Subdirectory"](https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher) approach. - -3. Therefore, modules that do not apply semver VCS tags and have not created a "Major Subdirectory" are effectively declaring themselves to be in the semver v0 major version series, and a module-based consumer will treat them as having a semver v0 major version. - -### Can a module depend on a different version of itself? - -A module can depend on a different major version of itself: by-and-large, this is comparable to depending on a different module. This can be useful for different reasons, including to allow a major version of a module to be implemented as a shim around a different major version. - -In addition, a module can depend on a different major version of itself in a cycle, just as two completely different modules can depend on each other in a cycle. - -However, if you are not expecting a module to depend on a different version of itself, it can be a sign of a mistake. For example, .go code intending to import a package from a v3 module might be missing the required `/v3` in the import statement. That mistake can manifest as a v3 module depending on the v1 version of itself. - -If you are surprised to see a module to depend on a different version of itself, it can be worthwhile to review the ["Semantic Import Versioning"](https://github.com/golang/go/wiki/Modules#semantic-import-versioning) section above along with the FAQ ["What can I check if I am not seeing the expected version of a dependency?"](https://github.com/golang/go/wiki/Modules#what-can-i-check-if-i-am-not-seeing-the-expected-version-of-a-dependency). - -It continues to be a constraint that two _packages_ may not depend on each other in a cycle. - -## FAQS — Multi-Module Repositories - -### What are multi-module repositories? - -A multi-module repository is a repository that contains multiple modules, each with its own go.mod file. Each module starts at the directory containing its go.mod file, and contains all packages from that directory and its subdirectories recursively, excluding any subtree that contains another go.mod file. - -Each module has its own version information. Version tags for modules below the root of the repository must include the relative directory as a prefix. For example, consider the following repository: - -``` -my-repo -`-- foo - `-- rop - `-- go.mod -``` - -The tag for version 1.2.3 of module "my-repo/foo/rop" is "foo/rop/v1.2.3". - -Typically, the path for one module in the repository will be a prefix of the others. For example, consider this repository: - -``` -my-repo -|-- bar -|-- foo -| |-- rop -| `-- yut -|-- go.mod -`-- mig - |-- go.mod - `-- vub -``` -![Fig. A top-level module's path is a prefix of another module's path.](https://github.com/jadekler/module-testing/blob/master/imagery/multi_module_repo.png) - -_Fig. A top-level module's path is a prefix of another module's path._ - -This repository contains two modules. However, the module "my-repo" is a prefix of the path of the module "my-repo/mig". - -### Should I have multiple modules in a single repository? - -Adding modules, removing modules, and versioning modules in such a configuration require considerable care and deliberation, so it is almost always easier and simpler to manage a single-module repository rather than multiple modules in an existing repository. - -Russ Cox commented in [#26664](https://github.com/golang/go/issues/26664#issuecomment-455232444): - -> For all but power users, you probably want to adopt the usual convention that one repo = one module. It's important for long-term evolution of code storage options that a repo _can_ contain multiple modules, but it's almost certainly not something you want to do by default. - -Two examples of how multi-modules can be more work: - * `go test ./...` from the repository root will no longer test everything in the repository - * you might need to routinely manage the relationship between the modules via `replace` directives. - -However, there is additional nuance beyond those two examples. Please read the FAQs in this [sub-section](https://github.com/golang/go/wiki/Modules#faqs--multi-module-repositories) carefully if you are considering having multiple modules in a single repository. - -Two example scenarios where it can make sense to have more than one `go.mod` in a repository: - -1. if you have usage examples where the examples themselves have a complex set of dependencies (e.g., perhaps you have a small package but include an example of using your package with kubernetes). In that case, it can make sense for your repository to have an `example` or `_example` directory with its own `go.mod`, such as shown [here](https://pkg.go.dev/github.com/loov/hrtime). - -2. if you have a repository with a complex set of dependencies, but you have a client API with a smaller set of dependencies. In some cases, it might make sense to have an `api` or `clientapi` or similar directory with its own `go.mod`, or to separate out that `clientapi` into its own repository. - -However, for both of those cases, if you are considering creating a multi-module repository for performance or download size for a large set of indirect dependencies, you are strongly encouraged to first try with a GOPROXY, which will be enabled by default in Go 1.13. Using a GOPROXY mostly equals any performance benefits or dependency download size benefits that might otherwise come from creating a multi-module repository. - -### Is it possible to add a module to a multi-module repository? - -Yes. However, there are two classes of this problem: - -The first class: the package to which the module is being added to is not in version control yet (a new package). This case is straightforward: add the package and the go.mod in the same commit, tag the commit, and push. - -The second class: the path at which the module is being added is in version control and contains one or more existing packages. This case requires a considerable amount of care. To illustrate, consider again the following repository (now in a github.com location to simulate the real-world better): - -``` -github.com/my-repo -|-- bar -|-- foo -| |-- rop -| `-- yut -|-- go.mod -`-- mig - `-- vub -``` - -Consider adding module "github.com/my-repo/mig". If one were to follow the same approach as above, the package /my-repo/mig could be provided by two different modules: the old version of "github.com/my-repo", and the new, standalone module "github.com/my-repo/mig. If both modules are active, importing "github.com/my-repo/mig" would cause an “ambiguous import” error at compile time. - -The way to get around this is to make the newly-added module depend on the module it was "carved out" from, at a version after which it was carved out. - -Let's step through this with the above repository, assuming that "github.com/my-repo" is currently at v1.2.3: - -1. Add github.com/my-repo/mig/go.mod: - - ``` - cd path-to/github.com/my-repo/mig - go mod init github.com/my-repo/mig - - # Note: if "my-repo/mig" does not actually depend on "my-repo", add a blank - # import. - # Note: version must be at or after the carve-out. - go mod edit -require github.com/myrepo@v1.3 - ``` - -1. `git commit` -1. `git tag v1.3.0` -1. `git tag mig/v1.0.0` -1. Next, let's test these. We can't `go build` or `go test` naively, since the go commands would try to fetch each dependent module from the module cache. So, we need to use replace rules to cause `go` commands to use the local copies: - - ``` - cd path-to/github.com/my-repo/mig - go mod edit -replace github.com/my-repo@v1.3.0=../ - go test ./... - go mod edit -dropreplace github.com/my-repo@v1.3.0 - ``` - -1. `git push origin master v1.3.0 mig/v1.0.0` push the commit and both tags - -Note that in the future [golang.org/issue/28835](https://github.com/golang/go/issues/28835) should make the testing step a more straightforward experience. - -Note also that code was removed from module "github.com/my-repo" between minor versions. It may seem strange to not consider this a major change, but in this instance the transitive dependencies continue to provide compatible implementations of the removed packages at their original import paths. - -### Is it possible to remove a module from a multi-module repository? - -Yes, with the same two cases and similar steps as above. - -### Can a module depend on an internal/ in another? - -Yes. Packages in one module are allowed to import internal packages from another module as long as they share the same path prefix up to the internal/ path component. For example, consider the following repository: - -``` -my-repo -|-- foo -| `-- go.mod -|-- go.mod -`-- internal -``` - -Here, package foo can import /my-repo/internal as long as module "my-repo/foo" depends on module "my-repo". Similarly, in the following repository: - -``` -my-repo -|-- foo -| `-- go.mod -`-- internal - `-- go.mod -``` - -Here, package foo can import my-repo/internal as long as module "my-repo/foo" depends on module "my-repo/internal". The semantics are the same in both: since my-repo is a shared path prefix between my-repo/internal and my-repo/foo, package foo is allowed to import package internal. - -### Can an additional go.mod exclude unnecessary content? Do modules have the equivalent of a .gitignore file? - -One additional use case for having multiple `go.mod` files in a single repository is if the repository has files that should be pruned from a module. For example, a repository might have very large files that are not needed for the Go module, or a multi-language repository might have many non-Go files. - -An empty `go.mod` in a directory will cause that directory and all of its subdirectories to be excluded from the top-level Go module. - -If the excluded directory does not contain any `.go` files, no additional steps are needed beyond placing the empty `go.mod` file. If the excluded directory does contain `.go` files, please first carefully review the other FAQs in [this multi-module repository section](https://github.com/golang/go/wiki/Modules#faqs--multi-module-repositories). - -## FAQs — Minimal Version Selection - -### Won't minimal version selection keep developers from getting important updates? - -Please see the question "Won't minimal version selection keep developers from getting important updates?" in the earlier [FAQ from the official proposal discussion](https://github.com/golang/go/issues/24301#issuecomment-371228664). - -## FAQs — Possible Problems - -### What are some general things I can spot check if I am seeing a problem? - -* Double-check that modules are enabled by running `go env` to confirm it does not show an empty value for the read-only `GOMOD` variable. - * Note: you never set `GOMOD` as a variable because it is effectively read-only debug output that `go env` outputs. - * If you are setting `GO111MODULE=on` to enable modules, double-check that it is not accidentally the plural `GO111MODULES=on`. (People sometimes naturally include the `S` because the feature is often called "modules"). -* If vendoring is expected to be used, check that the `-mod=vendor` flag is being passed to `go build `or similar, or that `GOFLAGS=-mod=vendor` is set. - * Modules by default ignore the `vendor` directory unless you ask the `go` tool to use `vendor`. -* It is frequently helpful to check `go list -m all` to see the list of actual versions selected for your build - * `go list -m all` usually gives you more detail compared to if you were to instead just look a `go.mod` file. -* If running `go get foo` fails in some way, or if `go build` is failing on a particular package `foo`, it often can be helpful to check the output from `go get -v foo` or `go get -v -x foo`: - * In general, `go get` will often provide more a detailed error message than `go build`. - * The `-v` flag to `go get` asks to print more verbose details, though be mindful that certain "errors" such as 404 errors _might_ be expected based on how a remote repository was configured. - * If the nature of the problem is still not clear, you can also try the more verbose `go get -v -x foo`, which also shows the git or other VCS commands being issued. (If warranted, you can often execute the same git commands outside of the context of the `go` tool for troubleshooting purposes). -* You can check to see if you are using a particularly old git version - * Older versions of git were a common source of problems for the `vgo` prototype and Go 1.11 beta, but much less frequently in the GA 1.11. -* The module cache in Go 1.11 can sometimes cause various errors, primarily if there were previously network issues or multiple `go` commands executing in parallel (see [#26794](https://github.com/golang/go/issues/26794), which is addressed for Go 1.12). As a troubleshooting step, you can copy $GOPATH/pkg/mod to a backup directory (in case further investigation is warranted later), run `go clean -modcache`, and then see whether the original problem persists. -* If you are using Docker, it can be helpful to check if you can reproduce the behavior outside of Docker (and if the behavior only occurs in Docker, the list of bullets above can be used as a starting point to compare results between inside Docker vs. outside). - -The error you are currently examining might be a secondary issue caused by not having the expected version of a particular module or package in your build. Therefore, if the cause of a particular error is not obvious, it can be helpful to spot check your versions as described in the next FAQ. - -### What can I check if I am not seeing the expected version of a dependency? - -1. A good first step is to run `go mod tidy`. There is some chance this might resolve the issue, but it will also help put your `go.mod` file into a consistent state with respect to your `.go` source code, which will help make any subsequent investigation easier. (If `go mod tidy` itself changes the versions of a dependency in a way you don't expect, first read [this FAQ on 'go mod tidy'](https://github.com/golang/go/wiki/Modules#why-does-go-mod-tidy-record-indirect-and-test-dependencies-in-my-gomod). If that does not explain it, you can try resetting your `go.mod` and then run `go list -mod=readonly all`, which might give a more specific message about whatever was requiring a change to its version). - -2. The second step usually should be to check `go list -m all` to see the list of actual versions selected for your build. `go list -m all` shows you the final selected versions, including for indirect dependencies and after resolving versions for any shared dependencies. It also shows the outcome of any `replace` and `exclude` directives. - -3. A good next step can be to examine the output of `go mod graph` or `go mod graph | grep `. `go mod graph` prints the module requirement graph (including taking into account replacements). Each line in the output has two fields: the first column is a consuming module, and the second column is one of that module's requirements (including the version required by that consuming module). This can be a quick way to see which modules are requiring a particular dependency, including when your build has a dependency that has different required versions from different consumers in your build (and if that is the case, it is important to be familiar with the behavior described in the ["Version Selection"](https://github.com/golang/go/wiki/Modules#version-selection) section above). - -`go mod why -m ` can also be useful here, although it is typically more useful for seeing why a dependency is included at all (rather than why a dependency ends up with a particular version). - -`go list` provides many more variations of queries that can be useful to interrogate your modules if needed. One example is the following, which will show the exact versions used in your build excluding test-only dependencies: -``` -go list -deps -f '{{with .Module}}{{.Path}} {{.Version}}{{end}}' ./... | sort -u -``` - -A more detailed set of commands and examples for interrogating your modules can be seen in a runnable "Go Modules by Example" [walkthough](https://github.com/go-modules-by-example/index/tree/master/018_go_list_mod_graph_why). - -One cause of unexpected versions can be due to someone having created an invalid or unexpected `go.mod` file that was not intended, or a related mistake (for example: a `v2.0.1` version of module might have incorrectly declared itself to be `module foo` in its `go.mod` without the required `/v2`; an import statement in `.go` code intended to import a v3 module might be be missing the required `/v3`; a `require` statement in a `go.mod` for a v4 module might be be missing the required `/v4`). Therefore, if the cause of a particular issue you are seeing is not obvious, it can be worthwhile to first re-read the material in the ["go.mod"](https://github.com/golang/go/wiki/Modules#gomod) and ["Semantic Import Versioning"](https://github.com/golang/go/wiki/Modules#semantic-import-versioning) sections above (given these include important rules that modules must follow) and then take a few minutes to spot check the most relevant `go.mod` files and import statements. - -### Why am I getting an error 'cannot find module providing package foo'? - -This is a general error message that can occur for several different underlying causes. - -In some cases, this error is simply due to a mistyped path, so the first step likely should be to double-check for incorrect paths based on the details listed in the error message. - -If you have not already done so, a good next step is often to try `go get -v foo` or `go get -v -x foo`: -* In general, `go get` will often provide more a detailed error message than `go build`. -* See the first troubleshooting FAQ in this section [above](https://github.com/golang/go/wiki/Modules#what-are-some-general-things-i-can-spot-check-if-i-am-seeing-a-problem) for more details. - -Some other possible causes: - -* You might see the error `cannot find module providing package foo` if you have issued `go build` or `go build .` but do not have any `.go` source files in the current directory. If this is what you are encountering, the solution might be an alternative invocation such as `go build ./...` (where the `./...` expands out to match all the packages within the current module). See [#27122](https://github.com/golang/go/issues/27122). - -* The module cache in Go 1.11 can cause this error, including in the face of network issues or multiple `go` commands executing in parallel. This is resolved in Go 1.12. See the first troubleshooting FAQ in this section [above](https://github.com/golang/go/wiki/Modules#what-are-some-general-things-i-can-spot-check-if-i-am-seeing-a-problem) for more details and possible corrective steps. - -### Why does 'go mod init' give the error 'cannot determine module path for source directory'? - -`go mod init` without any arguments will attempt to guess the proper module path based on different hints such as VCS meta data. However, it is not expected that `go mod init` will always be able to guess the proper module path. - -If `go mod init` gives you this error, those heuristics were not able to guess, and you must supply the module path yourself (such as `go mod init github.com/you/hello`). - -### I have a problem with a complex dependency that has not opted in to modules. Can I use information from its current dependency manager? - -Yes. This requires some manual steps, but can be helpful in some more complex cases. - -When you run `go mod init` when initializing your own module, it will automatically convert from a prior dependency manager by translating configuration files like `Gopkg.lock`, `glide.lock`, or `vendor.json` into a `go.mod` file that contains corresponding `require` directives. The information in a pre-existing `Gopkg.lock` file for example usually describes version information for all of your direct and indirect dependencies. - -However, if instead you are adding a new dependency that has not yet opted in to modules itself, there is not a similar automatic conversion process from any prior dependency manager that your new dependency might have been using. If that new dependency itself has non-module dependencies that have had breaking changes, then in some cases that can cause incompatibility problems. In other words, a prior dependency manager of your new dependency is not automatically used, and that can cause problems with your indirect dependencies in some cases. - -One approach is to run `go mod init` on your problematic non-module direct dependency to convert from its current dependency manager, and then use the `require` directives from the resulting temporary `go.mod` to populate or update the `go.mod` in your module. - -For example, if `github.com/some/nonmodule` is a problematic direct dependency of your module that is currently using another dependency manager, you can do something similar to: - -``` -$ git clone -b v1.2.3 https://github.com/some/nonmodule /tmp/scratchpad/nonmodule -$ cd /tmp/scratchpad/nonmodule -$ go mod init -$ cat go.mod -``` - -The resulting `require` information from the temporary `go.mod` can be manually moved into the actual `go.mod` for your module, or you can consider using https://github.com/rogpeppe/gomodmerge, which is a community tool targeting this use case. In addition, you will want to add a `require github.com/some/nonmodule v1.2.3` to your actual `go.mod` to match the version that you manually cloned. - -A concrete example of following this technique for docker is in this [#28489 comment](https://github.com/golang/go/issues/28489#issuecomment-454795390), which illustrates getting a consistent set of versions -of docker dependencies to avoid case sensitive issues between `github.com/sirupsen/logrus` vs. `github.com/Sirupsen/logrus`. - -### How can I resolve "parsing go.mod: unexpected module path" and "error loading module requirements" errors caused by a mismatch between import paths vs. declared module identity? - -#### Why does this error occur? - -In general, a module declares its identity in its `go.mod` via the `module` directive, such as `module example.com/m`. This is the "module path" for that module, and the `go` tool enforces consistency between that declared module path and the import paths used by any consumer. If a module's `go.mod` file reads `module example.com/m`, then a consumer must import packages from that module using import paths that start with that module path (e.g., `import "example.com/m"` or `import "example.com/m/sub/pkg"`). - -The `go` command reports a `parsing go.mod: unexpected module path` fatal error if there is a mismatch between an import path used by a consumer vs. the corresponding declared module path. In addition, in some cases the `go` command will then report a more generic `error loading module requirements` error afterwards. - -The most common cause of this error is if there was a name change (e.g., `github.com/Sirupsen/logrus` to `github.com/sirupsen/logrus`), or if a module was sometimes used via two different names prior to modules due to a vanity import path (e.g., `github.com/golang/sync` vs. the recommended `golang.org/x/sync`). - -This can then cause problems if you have a dependency that is still being imported via an older name (e.g., `github.com/Sirupsen/logrus`) or a non-canonical name (e.g., `github.com/golang/sync`) but that dependency has subsequently adopted modules and now declares its canonical name in its `go.mod`. The error here can then trigger during an upgrade when the upgraded version of the module is found declaring a canonical module path that no longer matches the older import path. - -#### Example problem scenario - -* You are indirectly depending on `github.com/Quasilyte/go-consistent`. -* The project adopts modules, and then later changes its name to `github.com/quasilyte/go-consistent` (changing `Q` to lowercase `q`), which is a breaking change. GitHub forwards from the old name to the new name. -* You run `go get -u`, which attempts to upgrade all of your direct and indirect dependencies. -* `github.com/Quasilyte/go-consistent` is attempted to be upgraded, but the latest `go.mod` found now reads `module github.com/quasilyte/go-consistent`. -* The overall upgrade operation fails to complete, with error: - -> go: github.com/Quasilyte/go-consistent@v0.0.0-20190521200055-c6f3937de18c: parsing go.mod: unexpected module path "github.com/quasilyte/go-consistent" -> go get: error loading module requirements - -#### Resolving - -The most common form of the error is: - -> go: example.com/some/OLD/name@vX.Y.Z: parsing go.mod: unexpected module path "example.com/some/NEW/name" - -If you visit the repository for `example.com/some/NEW/name` (from the right-side of the error), you can check the `go.mod` file for the latest release or `master` to see if it declares itself on the first line of the `go.mod` as `module example.com/some/NEW/name`. If so, that is a hint that you are seeing an "old module name" vs. "new module name" problem. - -This remainder of this section focuses on resolving the "old name" vs. "new name" form of this the error by following these steps in sequence: - -1. Check your own code to see if you are importing using `example.com/some/OLD/name`. If so, update your code to import using `example.com/some/NEW/name`. - -2. If you received this error during an upgrade, you should try upgrading using the tip version of Go, which has more targeted upgrade logic ([#26902](https://github.com/golang/go/issues/26902)) that can often sidestep this problem and also often has a better error message for this situation. Note that the `go get` arguments in tip / 1.13 are different than in 1.12. Example of obtaining tip and using it to upgrade your dependencies: -``` -go get golang.org/dl/gotip && gotip download -gotip get -u all -gotip mod tidy -``` -Because the problematic old import is often in an indirect dependency, upgrading with tip and then running `go mod tidy` can frequently upgrade you past the problematic version and then also remove the problematic version from your `go.mod` as no longer needed, which then puts you into a functioning state when you return to using Go 1.12 or 1.11 for day-to-day use. For example, see that approach work [here](https://github.com/golang/go/issues/30831#issuecomment-489463638) to upgrade past `github.com/golang/lint` vs. `golang.org/x/lint` problems. - -3. If you received this error while doing `go get -u foo` or `go get -u foo@latest`, try removing the `-u`. This will give you the set of dependencies used by `foo@latest` without upgrading the dependencies of `foo` past the versions that the author of `foo` likely verified as working when releasing `foo`. This can be important especially during this transitional time when some of the direct and indirect dependencies of `foo` might not yet have adopted [semver](https://semver.org) or modules. (A common mistake is thinking `go get -u foo` solely gets the latest version of `foo`. In actuality, the `-u` in `go get -u foo` or `go get -u foo@latest` means to _also_ get the latest versions for _all_ of the direct and indirect dependencies of `foo`; that might be what you want, but it might not be especially if it is otherwise failing due to deep indirect dependencies). - -4. If the steps above have not resolved the error, the next approach is slightly more complicated, but most often should work to resolve an "old name" vs. "new name" form of this error. This uses just information solely from the error message itself, plus some brief looking at some VCS history. - - 4.1. Go to the `example.com/some/NEW/name` repository - - 4.2. Determine when the `go.mod` file was introduced there (e.g., by looking at the blame or history view for the `go.mod`). - - 4.3. Pick the release or commit from _just before_ the `go.mod` file was introduced there. - - 4.4. In your `go.mod` file, add a `replace` statement using the old name on both sides of the `replace` statement: - ``` - replace example.com/some/OLD/name => example.com/some/OLD/name - ``` -Using our prior example where `github.com/Quasilyte/go-consistent` is the old name and `github.com/quasilyte/go-consistent` is the new name, we can see that the `go.mod` was first introduced there in commit [00c5b0cf371a](https://github.com/quasilyte/go-consistent/tree/00c5b0cf371a96059852487731370694d75ffacf). That repository is not using semver tags, so we will take the immediately prior commit [00dd7fb039e](https://github.com/quasilyte/go-consistent/tree/00dd7fb039e1eff09e7c0bfac209934254409360) and add it to the replace using the old uppercase Quasilyte name on both sides of the `replace`: - -``` -replace github.com/Quasilyte/go-consistent => github.com/Quasilyte/go-consistent 00dd7fb039e -``` - -This `replace` statement then enables us to upgrade past the problematic "old name" vs. "new name" mismatch by effectively preventing the old name from being upgraded to the new name in the presence of a `go.mod`. Usually, an upgrade via `go get -u` or similar can now avoid the error. If the upgrade completes, you can check to see if anyone is still importing the old name (e.g., `go mod graph | grep github.com/Quasilyte/go-consistent`) and if not, the `replace` can then be removed. (The reason this often works is because the upgrade itself can otherwise fail if an old problematic import path is used even though it might not be used in the final result if the upgrade had completed, which is tracked in [#30831](https://github.com/golang/go/issues/30831)). - -5. If the above steps have not resolved the problem, it might be because the problematic old import path is still in use by the latest version of one or more of your dependencies. In this case, it is important to identify who is still using the problematic old import path, and find or open an issue asking that the problematic importer change to using the now canonical import path. Using `gotip` in step 2. above might identify the problematic importer, but it does not do so in all cases, especially for upgrades ([#30661](https://github.com/golang/go/issues/30661#issuecomment-480981833)). If it is unclear who is importing using the problematic old import path, you can usually find out by creating a clean module cache, performing the operation or operations that trigger the error, and then grepping for the old problematic import path within the module cache. For example: - -``` -export GOPATH=$(mktemp -d) -go get -u foo # peform operation that generates the error of interest -cd $GOPATH/pkg/mod -grep -R --include="*.go" github.com/Quasilyte/go-consistent -``` - -6. If these steps are not sufficient to resolve the issue, or if you are a maintainer of a project that seems unable to remove references to an older problematic import path due to circular references, please see a much more detailed write-up of the problem on a separate [wiki page](https://github.com/golang/go/wiki/Resolving-Problems-From-Modified-Module-Path). - -Finally, the above steps focus on how to resolve an underlying "old name" vs. "new name" problem. However, the same error message can also appear if a `go.mod` was placed in the wrong location or simply has the wrong module path. If that is the case, the importing that module should always fail. If you are importing a new module that you just created and has never been successfully imported before, you should check that the `go.mod` file is located correctly and that it has the proper module path that corresponds to that location. (The most common approach is a single `go.mod` per repository, with the single `go.mod` file placed in the repository root, and using the repository name as the module path declared in the `module` directive). See the ["go.mod"](https://github.com/golang/go/wiki/Modules#gomod) section for more details. - -### Why does 'go build' require gcc, and why are prebuilt packages such as net/http not used? - -In short: - -> Because the pre-built packages are non-module builds and can’t be reused. Sorry. Disable cgo for now or install gcc. - -This is only an issue when opting in to modules (e.g., via `GO111MODULE=on`). See [#26988](https://github.com/golang/go/issues/26988#issuecomment-417886417) for additional discussion. - -### Do modules work with relative imports like `import "./subdir"`? - -No. See [#26645](https://github.com/golang/go/issues/26645#issuecomment-408572701), which includes: - -> In modules, there finally is a name for the subdirectory. If the parent directory says "module m" then the subdirectory is imported as "m/subdir", no longer "./subdir". - -### Some needed files may not be present in populated vendor directory - -Directories without `.go` files are not copied inside the `vendor` directory by `go mod vendor`. This is by design. - -In short, setting aside any particular vendoring behavior – the overall model for go builds is that the files needed to build a package should be in the directory with the `.go` files. - -Using the example of cgo – modifying C source code in other directories will not trigger a rebuild, and instead your build will use stale cache entries. The cgo documentation now [includes](https://go-review.googlesource.com/c/go/+/125297/5/src/cmd/cgo/doc.go): - -> Note that changes to files in other directories do not cause the package -to be recompiled, so _all non-Go source code for the package should be -stored in the package directory_, not in subdirectories. - -A community tool https://github.com/goware/modvendor allows you to easily copy a complete set of .c, .h, .s, .proto or other files from a module into the `vendor` directory. Although this can be helpful, some care must be taken to make sure your go build is being handled properly in general (regardless of vendoring) if you have files needed to build a package that are outside of the directory with the `.go` files. - -See additional discussion in [#26366](https://github.com/golang/go/issues/26366#issuecomment-405683150). - -An alternative approach to traditional vendoring is to check in the module cache. It can end up with similar benefits as traditional vendoring and in some ways ends up with a higher fidelity copy. This approach is explained as a "Go Modules by Example" [walkthrough](https://github.com/go-modules-by-example/index/blob/master/012_modvendor/README.md). diff --git a/MutexOrChannel.md b/MutexOrChannel.md index 4c4c679d..51ca008a 100644 --- a/MutexOrChannel.md +++ b/MutexOrChannel.md @@ -1,34 +1,4 @@ -# Use a sync.Mutex or a channel? +The Go wiki on GitHub has moved to go.dev (#61940). -One of Go's mottos is _"Share memory by communicating, don't communicate by sharing memory."_ +Try or . -That said, Go does provide traditional locking mechanisms in the sync package. Most locking issues can be solved using either channels or traditional locks. - -So which should you use? - -Use whichever is most expressive and/or most simple. - -A common Go newbie mistake is to over-use channels and goroutines just because it's possible, and/or because it's fun. Don't be afraid to use a sync.Mutex if that fits your problem best. Go is pragmatic in letting you use the tools that solve your problem best and not forcing you into one style of code. - -As a general guide, though: - -| **Channel** | **Mutex** | -|:------------|:----------| -| passing ownership of data,
    distributing units of work,
    communicating async results | caches,
    state | - -If you ever find your sync.Mutex locking rules are getting too complex, ask yourself whether using channel(s) might be simpler. - -### Wait Group - -Another important synchronisation primitive is sync.WaitGroup. These allow co-operating goroutines to collectively wait for a threshold event before proceeding independently again. This is useful typically in two cases. - -Firstly, when 'cleaning up', a sync.WaitGroup can be used to ensure that all goroutines - including the main one - wait before all terminating cleanly. - -The second more general case is of a cyclic algorithm that involves a set of goroutines that all work independently for a while, then all wait on a barrier, before proceeding independently again. This pattern might be repeated many times. Data might be exchanged at the barrier event. This strategy is the basis of [Bulk Synchronous Parallelism](https://en.wikipedia.org/wiki/Bulk_synchronous_parallel) (BSP). - -Channel communication, mutexes and wait-groups are complementary and can be combined. - -### More Info - - * Channels in Effective Go: https://go.dev/doc/effective_go#channels - * The sync package: https://pkg.go.dev/sync/ \ No newline at end of file diff --git a/NetBSD.md b/NetBSD.md index 9284e23f..5ccc64c0 100644 --- a/NetBSD.md +++ b/NetBSD.md @@ -1,28 +1,4 @@ -# Go on NetBSD +The Go wiki on GitHub has moved to go.dev (#61940). -Go on NetBSD is fairly stable on the architectures below. However, some bugs remain; see the [issue tracker](https://github.com/golang/go/issues?q=is%3Aissue+is%3Aopen+label%3AOS-NetBSD) for details. +Try or . -| **Kernel version** | **Architectures** | **Initial support version** | **Final support version** | -|:----------------------|:------------------|:----------------------------|:--------------------------| -| 8.0 or above | amd64, arm, 386 | | | -| 7.0 through 7.1 | amd64, arm, 386 | Go 1.3 _*_ | | -| 6.0 through 6.1 | amd64, arm, 386 | Go 1.3 _*_ | Go 1.9.7 | -| 5.0 through 5.2 (EOL) | amd64, 386 | Go 1 | Go 1.2.2 | - -_*_ Go 1.5 or above is recommended. - -Support for the arm64 architecture is a work in progress, see https://go.dev/issue/30824. - -# Go packages in pkgsrc - -[pkgsrc](https://pkgsrc.org/), the NetBSD package collection, contains up-to-date packages for released Go versions. The packages contain the version in the name (e.g. [`lang/go113`](http://pkgsrc.se/lang/go113)) so that multiple versions can be installed in parallel. [`lang/go`](http://pkgsrc.se/lang/go) is a meta-package that always depends on the default go version. - -Note that the `go` binary name is also installed with a version suffix. Install the [`pkgtools/pkg_alternatives`](http://pkgsrc.se/pkgtools/pkg_alternatives) package to get a `go` command symlink in your PATH. - -There are a number of packages for software written in Go in pkgsrc. At the moment, module-based builds are experimental, and packages are built using a GOPATH layout. - -# Preparing NetBSD for Go - - * install NetBSD (remember to install pkgsrc in the last step) - * install shells/bash and devel/git (do ` make package-install clean ` in ` /usr/pkgsrc/shells/bash ` and ` /usr/pkgsrc/devel/git `. - * Using binary packages: ` pkgin install bash git ` \ No newline at end of file diff --git a/NewSpeakers.md b/NewSpeakers.md index e909080c..66d7714d 100644 --- a/NewSpeakers.md +++ b/NewSpeakers.md @@ -1,49 +1,4 @@ -# Resources for New Speakers +The Go wiki on GitHub has moved to go.dev (#61940). -Go needs everyone's help. -We want to see more new speakers with new perspectives at Go conferences, -especially more women and others underrepresented in the Go community. +Try or . -The process of applying to speak at a tech conference can be a bit opaque and confusing -for first-time speakers. -In general, please remember that, first and foremost, -conferences organizers want to find great talks; -there is no single format or recipe for a great talk; -and you need not be a Go expert to give a great talk. -All that you need to be is excited about sharing something -you've observed or learned about using Go. - -Here are some good blog posts with tips for writing conference talk proposals: - -- “[How to write a successful conference proposal](https://dave.cheney.net/2017/02/12/how-to-write-a-successful-conference-proposal)” by Dave Cheney -- “[How to write a successful conference proposal](https://medium.com/@fox/how-to-write-a-successful-conference-proposal-4461509d3e32)” by Karolina Szczur -- “[Is your conference proposal good enough?](http://rckbt.me/2014/01/conference-proposals/)” by Raquel Vélez (rockbot) -- “[What your conference proposal is missing](http://www.sarahmei.com/blog/2014/04/07/what-your-conference-proposal-is-missing/)” by Sarah Mei - -Elsewhere on the wiki, we maintain a list of [upcoming conferences](Conferences) with links to CFPs. -The same page also lists past conferences with links to talk videos. These conferences welcome speakers of all experience levels and backgrounds! - -## Contact Us - -We, the Go community members listed below, -are happy to discuss or review talk proposals -and answer other questions about the overall speaking process. -Feel free to contact any of us directly. - -- Russ Cox, rsc@golang.org, [@_rsc](https://twitter.com/_rsc) -- Steve Francia, spf@golang.org, [@spf13](https://twitter.com/spf13) -- William Kennedy, bill@ardanlabs.com, [@goinggodotnet](https://twitter.com/goinggodotnet) -- Cassandra Salisbury, cassandra@golangbridge.org, [@cassandraoid](https://twitter.com/cassandraoid) -- Ashley McNamara, ashmc@microsoft.com, [@ashleymcnamara](https://twitter.com/ashleymcnamara) -- Brian Ketelsen, bjk@microsoft.com, [@bketelsen](https://twitter.com/bketelsen) -- Natalie Pistunovich natalie@golangbridge.org, [@nataliepis](https://twitter.com/nataliepis) -- Erik St. Martin, erikstm@microsoft.com, [@erikstmartin](https://twitter.com/erikstmartin) -- Francesc Campoy, campoy@golang.org, [@francesc](https://twitter.com/francesc) -- Sameer Ajmani, sameer@google.com, [@Sajma](https://twitter.com/Sajma) -- Florin Pățan, florinpatan@gmail.com, [@dlsniper](https://twitter.com/dlsniper) -- Aaron Schlesinger, arschles@gmail.com, [@arschles](https://twitter.com/arschles) -- Paul Jolly, paul@myitcv.io [@_myitcv](https://twitter.com/_myitcv) -- Alexey Palazhchenko, alexey.palazhchenko@gmail.com [@paaleksey](https://twitter.com/paaleksey) (English, Russian) -- Carmen Andoh, candoh@google.com, [@carmatrocity](https://twitter.com/carmatrocity) - -(Experienced speakers, feel free to add your contact information to the list, or email rsc@golang.org if you don't have wiki edit permission.) \ No newline at end of file diff --git a/NoPlusOne.md b/NoPlusOne.md index 60538e90..3eeaeba3 100644 --- a/NoPlusOne.md +++ b/NoPlusOne.md @@ -1,31 +1,4 @@ -When contributing to the Go issue tracker, please **do not** make comments like this: +The Go wiki on GitHub has moved to go.dev (#61940). -> +1 +Try or . -or - -> :+1: - -or - -> Me too. - -or - -> I too would like to see this issue fixed. - -or - -> When is this issue going to be fixed? - -Such comments do not help fix issues. In fact, they make it harder by cluttering the discussion. The project admins will delete such comments as a matter of procedure (please don't be offended if we delete yours). - -Instead of commenting, you may [add a :+1: reaction](https://help.github.com/articles/about-discussions-in-issues-and-pull-requests/#reacting-to-ideas-in-issues-and-pull-requests) to the comment or issue. - -Of course, **please do comment** if your "me too" comment includes information that might help resolve the issue. This includes reports like this: - -> This issue also affects me on Windows 10 when running all.bat at revision c0ff33. - -(Although there's no need to make such a comment if an identical comment already exists.) - -Thanks! \ No newline at end of file diff --git a/NonEnglish.md b/NonEnglish.md index c6096ea8..0259b39c 100644 --- a/NonEnglish.md +++ b/NonEnglish.md @@ -1,71 +1,4 @@ -Some of this documentation may be out of date. +The Go wiki on GitHub has moved to go.dev (#61940). -## Belarusian - Беларуская +Try or . - * [faq-be](http://www.designcontest.com/show/faq-be) - Frequently Asked Questions. - -## Brazilian Portuguese - Português brasileiro - - * [A Tour of Go](https://go-tour-br.appspot.com/) - * [golangbr.org](http://golangbr.org/) - Go documentation and news. - -## Chinese - 中文 - - * [Go 语言之旅](https://tour.go-zh.org/) - * [Go 编程语言](https://go-zh.org/) - Chinese Translation of tip.golang.org - * [Effective Go and (old) Tutorial (Deprecated)](http://code.google.com/p/ac-me/downloads/detail?name=fango.pdf) - -## Czech - Čeština - - * [Pravidla reflexe](http://www.abclinuxu.cz/clanky/google-go-pravidla-reflexe) - a translation of [The Laws of Reflection](https://go.dev/blog/2011/09/laws-of-reflection.html). - -## French - Français - - * [golang-france](http://code.google.com/p/golang-france/) - Go documentation. - -## German - Deutsch - - * [Deutschsprachige Go Themenseite - German Go resource page](https://github.com/hweidner/golang-de/wiki) - * [Deutschsprachiges Diskussionsforum - German discussion forum](https://mewe.com/group/5c4b0dcb1c1ea52d0c45b6b0) on [MeWe](https://mewe.com) - ([Invitation link](https://mewe.com/join/golang-de)) (requires free registration on MeWe.com). - -## Indonesia - - * [Komunitas Pengguna Go Indonesia](https://golang-id.org) - -## Japanese - 日本語 - - * [A Tour of Go](https://go-tour-jp.appspot.com/) - * [CodeReviewComments](https://knsh14.github.io/translations/go-codereview-comments/) - -## Korean - 한국어 - - * [A Tour of Go](http://go-tour-kr.appspot.com) - * [golang-kr wiki](http://github.com/golang-kr/golang-doc/wiki) - Korean Translation of golang.org/doc - -## Russian - русский язык - - * [Effective Go](https://github.com/Konstantin8105/Effective_Go_RU/blob/master/README.md) - * [Contribution Guide](https://github.com/Konstantin8105/Contribution_Guide_RU) - -## Spanish - español - * [Video course: Go Course from 0 to 100](https://www.youtube.com/watch?v=7SIIyt5-XK0&list=PLl_hIu4u7P64MEJpR3eVwQ1l_FtJq4a5g) - * [Workshop video: Creating a wiki with Go](https://www.youtube.com/watch?v=0fYb43gIl6I&list=PLfHn_OMWQAHDNxoA3BRWs5NHcstZMAY_B) - * [Sitio web: Go con ejemplos](http://goconejemplos.com/) - * [Apuntes: Aprender de Go desde Cero](https://apuntes.de/golang/) - -## Thai - ไทย - - * [A Tour of Go](https://go-tour-th.appspot.com) - -## Turkish - Türkçe - - * [A Tour of Go](https://go-tour-turkish.appspot.com) - -## Vietnamese - Tiếng Việt - - * [A Tour of Go](http://go-tour-vi.appspot.com/) - -## Uzbek — Ўзбекча - - * [A Tour of Go](http://go-tour-uz.appspot.com/) \ No newline at end of file diff --git a/OpenBSD.md b/OpenBSD.md index feccd5e0..b974f002 100644 --- a/OpenBSD.md +++ b/OpenBSD.md @@ -1,67 +1,4 @@ -# Go on OpenBSD +The Go wiki on GitHub has moved to go.dev (#61940). -Go is available within the OpenBSD ports tree collection since OpenBSD 5.2. It is marked as i386- and amd64- only. See [`ports/lang/go`](http://ports.su/lang/go) for details. +Try or . -| **OpenBSD release** | **Go in ports** | -|:--------------------|:--------------------| -| 6.8 (Oct 18, 2020) | go-1.15.2 | -| 6.7 (May 19, 2020) | go-1.13.9 | -| 6.6 (Oct 17, 2019) | go-1.13.1 | -| 6.5 (Apr 4, 2019) | go-1.12.1 | -| 6.4 (Oct 18, 2018) | go-1.11 | -| 6.3 (Apr 2, 2018) | go-1.10 | -| 6.2 (Oct 9, 2017) | go-1.9 | -| 6.1 (Apr 11, 2017) | go-1.8 | -| 6.0 (Sep 1, 2016) | go-1.6.3 | -| 5.9 (Mar 29, 2016) | go-1.5.4 | -| 5.8 (Oct 18, 2015) | go-1.4.2 | -| 5.7 (May 1, 2015) | go-1.4.1 | -| 5.6 (Nov 1, 2014) | go-1.3p0 | - -## Building from source - -| **Kernel version** | **Architectures** | **Initial support version** | **Final support version** | -|:-------------------|:------------------|:----------------------------|:--------------------------| -| 6.4 | amd64, arm, 386 | Go 1.11 | | -| 6.2 through 6.3 | amd64, arm, 386 | Go 1.9 | Go 1.15.x | -| 6.1 | amd64, arm, 386 | Go 1.8 | Go 1.10.8 | -| 6.0 | amd64, 386 | Go 1.4.1 _*_ | Go 1.10.8 | -| 6.0 | arm | Go 1.5 | Go 1.10.8 | -| 5.9 | amd64, 386 | Go 1.4.1 _*_ | Go 1.8.7 | -| 5.9 | arm | Go 1.5 | Go 1.8.7 | -| 5.6 through 5.8 | amd64, 386 | Go 1.4.1 _*_ | Go 1.7.6 | -| 5.5 | amd64, 386 | Go 1.3 _*_ | Go 1.7.6 | -| 5.0 through 5.4 | amd64, 386 | Go 1 | Go 1.2.2 | - -_*_ Go 1.5 or above is recommended. - -## Longterm support - -Go aims to support the two most recent OpenBSD releases, because OpenBSD officially supports only the two most recent releases, and makes a best-effort attempt to maintain ABI support in consecutive releases. - -## ulimits (` /etc/login.conf `) - -Edit `/etc/login.conf` so that the staff class has the proper -settings. The following is a working example of the staff class: -``` -staff:\ - :datasize-cur=infinity:\ - :datasize-max=infinity:\ - :datasize=infinity:\ - :openfiles-cur=4096:\ - :maxproc-max=512:\ - :maxproc-cur=512:\ - :ignorenologin:\ - :requirehome@:\ - :tc=default: -``` - -If the database file `/etc/login.conf.db` exists, you need to rebuild it with: -``` -# cap_mkdb /etc/login.conf -``` - -Ensure that the user you intend to build Go with is in the `staff` login class: -``` -# usermod -L staff your_username_here -``` \ No newline at end of file diff --git a/PGO-Tools.md b/PGO-Tools.md index cc96ff32..577c97eb 100644 --- a/PGO-Tools.md +++ b/PGO-Tools.md @@ -1,13 +1,4 @@ -[Profile-guided optimization](https://go.dev/doc/pgo) (PGO) in the Go toolchain uses CPU pprof profiles as the PGO profile format. Though pprof is a widely-used format across many tools, Go's PGO imposes [specific requirements](https://go.dev/doc/pgo#alternative-sources) on the contents of profiles, which many tools across the ecosystem may not be compatible with. +The Go wiki on GitHub has moved to go.dev (#61940). -This (non-exhaustive) page lists tools for collecting and working with profiles that are known to be compatible with PGO. +Try or . -# Collecting profiles - -* [`runtime/pprof`](https://pkg.go.dev/runtime/pprof), [`net/http/pprof`](https://pkg.go.dev/net/http/pprof): The Go standard library profiling functionality always provides PGO-compatible profiles. -* [Parca Agent](https://github.com/parca-dev/parca-agent) produces PGO-compatible profiles when paired with a symbolizer that produces metadata that includes function start lines, such as [Polar Signals Cloud](https://www.polarsignals.com/) or [Parca](https://www.parca.dev/) starting at version `v0.19.0`. - -# Working with profiles - -* `go tool pprof`/[standalone `pprof` CLI](https://github.com/google/pprof), [`github.com/google/pprof/profile`](https://pkg.go.dev/github.com/google/pprof/profile): The official `pprof` CLI and Go packages can perform various operations on profiles (filtering, merging multiple profiles, etc). These tools/packages generally leave metadata (e.g., symbolization, function start lines) intact across operations. Thus given a PGO-compatible input, they should produce a PGO-compatible output. -* [Parca](https://www.parca.dev/) and [Polar Signals Cloud](https://www.polarsignals.com/) provide various mechanisms to query and filter profiling data and download any query as a pprof file that will contain function start line metadata to be PGO-compatible. \ No newline at end of file diff --git a/PackagePublishing.md b/PackagePublishing.md index 9a264b7a..4c39a7a4 100644 --- a/PackagePublishing.md +++ b/PackagePublishing.md @@ -1,130 +1,4 @@ -# Introduction -Now that you've spent many hours writing your package and debugging it and testing it (you did [[test it|TableDrivenTests]], didn't you?), you want to publish it so other people can [go get](https://pkg.go.dev/cmd/go/) your package. +The Go wiki on GitHub has moved to go.dev (#61940). -First, you will need to host it online somewhere. Three major code hosting sites are [bitbucket](http://bitbucket.org/) (hg/git), [GitHub](http://github.com/) (git) and [launchpad](http://launchpad.net) (bzr). I recommend choosing whichever version control system you are familiar with or which your code is versioned locally on your machine. Git (git) is the version control system used by the central Go repository, so it is the closest to a guarantee as you can get that a developer wanting to use your project will have the right software. If you have never used version control before, these websites have some nice HOWTOs and you can find many great tutorials by searching Google for "{name} tutorial" where {name} is the name of the version control system you would like to learn. +Try or . -# Package Setup -## Choosing the Import -The full import of your package often has something identifying its author (particularly on hosting sites like GitHub, where "github.com/kylelemons/..." is the full import), should always have the project name, and should end with the name of the package you've developed if it is different from the project name. For instance, the go-gypsy project provides a yaml package, and is written by Kyle Lemons, and thus has the following import path: -``` -import "github.com/kylelemons/go-gypsy/yaml" - ^ ^ ^ ^ - | | | `-- Package name - | | `-------- Project name - | `------------------- Author's handle - `----------------------------- Hosting site -``` - -Go >= version 1 supports subdirectories of package repositories. - -## Subdirectories - -Frequently, the name that you use for your package will include the name "Go" as a prefix, suffix, or part of its acronym, and you may or may not want this to be a part of the actual command or package name in a go source file. Often, you may have both libraries and commands as a part of your package, and these cannot coexist in the same directory. When these things happen, you will want to structure your repository with subdirectories. - -For example, consider a project "Go-PublishingExample" that provides an "epub" package and a "publish" command. The directory structure could be: -``` -./epub/ # Package source, all files package "epub" -./publish/ # Command source -./doc/ # Documentation which won't be downloaded -./examples/ # Example code which won't be downloaded -``` - -The import statement for the package would look like: -``` -import "codesite.tld/authorName/Go-PublishingExample/epub" -``` - -It is often a good idea to make sure the last directory path (in this case, "epub") matches the name of the package used by the source files in the directory. In this case, no go get-able files were included in the base directory because neither the binary nor the package were to be named "Go-PublishingExample". - -## Branches and Tags - -**Please note that this section is out of date.** The pseudo version numbers below were applicable to Go < version 1; also the Go repository itself uses Git instead of Mercurial now. **Maybe we should remove this section.** - -**You can get up to date information on go get using "go help get" and "go help importpath".** - -In general, the Go source tree can exist in three basic states. It can be checked out at a Go Release branch (r60 (on Google Code) at the time of this writing -- this is where most users should be), or it can be checked out at a Go Weekly (a new tag for which is made roughly once per week), or at tip (the Mercurial term for the latest change). The last two are primarily for developers of the Go language itself or developers who need features or fixes which have not been introduced into the latest Release. - -Due to the lielihood that you might continue collaborating on your project with your team on code that is not ready for general consumption, it is recommended that you utilize the tagging or branching functionality of your version control system. The go get tool understands some special tags and branches, which you may want to use to ensure users get a compatible version of your package: -``` - go.r60 -- A "go.r##" tag will be checked out if the user has that Go release installed - go.weekly.2011-07-19 -- A "go.weekly.YYYY-MM-DD" tag will be checked out if the user has that weekly installed -``` - -Go get will attempt to fall back to the previous tag if the installed one has no matches, and if none are found, will default to installing tip. - -To create and maintain your release tag in mercurial: -``` -# Create or update a release tag -hg tag myProj-v0.0 # tag an easy-to-remember version number if you wish -hg tag go.r60 # tag this as being go release.r60 compatible -``` - -To create and maintain a release branch in git: -``` -# Create a release branch -git tag myProj-v0.0 # Tag an easy-to-remember version number if you wish -git checkout -b go.r60 # create a release branch -git checkout master # to switch back to your master branch - -# Update the release branch -git checkout go.r60 # switch to the release branch -git merge master # merge in changes from the master branch since last release -git checkout master # switch back to master branch -``` -If you are using other branch names, substitute those names where necessary. - -It will typically not be necessary to maintain weekly tags or branches, but it can be very useful to maintain the release branch or tag, as this will ensure the widest audience for your project. - -## Commands vs Packages -Since go get does not use your project's Makefiles, it is important to understand how it will actually build your project. - -All files in the same directory should always share the same package name. Any files named with a ` _test ` or an ` _os ` and/or ` _arch ` suffix will be ignored (unless the os/arch match). If the package name is "main", go get will build an executable from the source files and name it according to the directory name (using the last path segment only). If the package name is anything else, go get will build it as a package and the import path will be the web-accessible URL for your project's root followed by the subdirectory. See [the go get documentation](https://pkg.go.dev/cmd/go/#hdr-Download_and_install_packages_and_dependencies) for how to make import paths for code hosting sites other than the main four. - -Dependencies between packages in the same project are common. In the case where one package or command in your project depends upon another, you must use the full import path in order for go get to recognize the dependency and make sure it is built. Third-party packages which are imported from source files in your project will also be automatically downloaded and installed by go get if it is not already present. - -To reuse the example above, the file ` ./publish/main.go ` may look something like this: -``` -package main - -import ( - "flag" -) - -import "codesite.tld/authorName/Go-PublishingExample/epub" - -var dir = flag.String("dir", ".", "Directory to publish") - -func main() { - flag.Parse() - epub.Publish(*dir) -} -``` - -A user wishing to install this executable would execute: -``` -go get codesite.tld/authorName/Go-PublishingExample/publish -``` -which would also install the ` ".../epub" ` package because of the dependency. A developer simply wishing to install the library could execute: -``` -go get codesite.tld/authorName/Go-PublishingExample/epub -``` -and (if they had not already installed ` publish `) would only download and install the package. Note that in none of these cases are the examples or documentation downloaded; in most cases these would be available to browse via the code site. - -# Documentation -## godoc -When you are preparing to publish a package, you should make sure that the documentation looks correct by running a local copy of godoc. If your package is installed to the go package tree, you can use the following command: -``` - godoc -http=:6060 & -``` - -Then browse to http://localhost:6060/pkg/ and find your package. - -## Dashboard -The Go Dashboard will use the first line of your package-level comment (also using the normal godoc format) as the "info" text, so make sure this is set. For instance: - -``` -// Package epub is an example publishing library. -package epub -``` - -For more information on godoc, see the [Documenting Go Code](https://go.dev/blog/2011/03/godoc-documenting-go-code.html) blog post. diff --git a/PanicAndRecover.md b/PanicAndRecover.md index 53e4c42b..99988057 100644 --- a/PanicAndRecover.md +++ b/PanicAndRecover.md @@ -1,89 +1,4 @@ -Table of Contents -================= +The Go wiki on GitHub has moved to go.dev (#61940). -+ [Panic](#panic) -+ [Usage in a Package](#usage-in-a-package) -+ [References](#references) +Try or . -# Panic - -The `panic` and `recover` functions behave similarly to exceptions and try/catch in some other languages in that a `panic` causes the program stack to begin unwinding and `recover` can stop it. Deferred functions are still executed as the stack unwinds. If `recover` is called inside such a deferred function, the stack stops unwinding and `recover` returns the value (as an `interface{}`) that was passed to `panic`. The runtime will also panic in extraordinary circumstances, such as indexing an array or slice out-of-bounds. If a `panic` causes the stack to unwind outside of any executing goroutine (e.g. `main` or the top-level function given to `go` fail to recover from it), the program exits with a stack trace of all executing goroutines. A `panic` cannot be `recover`ed by a different goroutine. - -# Usage in a Package - -By convention, no explicit `panic()` should be allowed to cross a package boundary. Indicating error conditions to callers should be done by returning error value. Within a package, however, especially if there are deeply nested calls to non-exported functions, it can be useful (and improve readability) to use panic to indicate error conditions which should be translated into error for the calling function. Below is an admittedly contrived example of a way in which a nested function and an exported function may interact via this panic-on-error relationship. - -```go -// A ParseError indicates an error in converting a word into an integer. -type ParseError struct { - Index int // The index into the space-separated list of words. - Word string // The word that generated the parse error. - Error error // The raw error that precipitated this error, if any. -} - -// String returns a human-readable error message. -func (e *ParseError) String() string { - return fmt.Sprintf("pkg: error parsing %q as int", e.Word) -} - -// Parse parses the space-separated words in input as integers. -func Parse(input string) (numbers []int, err error) { - defer func() { - if r := recover(); r != nil { - var ok bool - err, ok = r.(error) - if !ok { - err = fmt.Errorf("pkg: %v", r) - } - } - }() - - fields := strings.Fields(input) - numbers = fields2numbers(fields) - return -} - -func fields2numbers(fields []string) (numbers []int) { - if len(fields) == 0 { - panic("no words to parse") - } - for idx, field := range fields { - num, err := strconv.Atoi(field) - if err != nil { - panic(&ParseError{idx, field, err}) - } - numbers = append(numbers, num) - } - return -} -``` - -To demonstrate the behavior, consider the following main function: -```go -func main() { - var examples = []string{ - "1 2 3 4 5", - "100 50 25 12.5 6.25", - "2 + 2 = 4", - "1st class", - "", - } - - for _, ex := range examples { - fmt.Printf("Parsing %q:\n ", ex) - nums, err := Parse(ex) - if err != nil { - fmt.Println(err) - continue - } - fmt.Println(nums) - } -} -``` - -# References -[Defer, Panic and Recover](https://go.dev/blog/defer-panic-and-recover) - -https://go.dev/ref/spec#Handling_panics - -https://go.dev/ref/spec#Run_time_panics diff --git a/PerfDashboard.md b/PerfDashboard.md index 07542d9b..44b421d0 100644 --- a/PerfDashboard.md +++ b/PerfDashboard.md @@ -1,63 +1,4 @@ -*The perf dashboard is unmaintained and currently not active* +The Go wiki on GitHub has moved to go.dev (#61940). -# Introduction +Try or . -[Performance Dashboard](http://build.golang.org/perf) does continuous monitoring of performance characteristics of the Go implementation. It notifies codereview threads about any significant changes caused by the commit, allows to see performance changes caused by [recent commits](http://build.golang.org/perf), allows to investigate changes [in detail](http://build.golang.org/perfdetail?commit=fb3d6c1631c3f3141f33a01afb4c0a23ef0ea2cf&commit0=82f48826c6c79a3d5697d5e06cac8451f3dc3c7f&kind=builder&builder=linux-amd64-perf&benchmark=http) . - -# Builders - -The dashboard uses two builders: linux-amd64 running Ubuntu 14.04 and windows-amd64 running Windows 8.1. Both builders has the same hardware: 2 x Intel Xeon E5620 @ 2.4GHz, 8 HT cores, 12GB RAM. - -# Benchmarks - -The builders run benchmarks from the [x/benchmarks](https://golang.org/x/benchmarks) repo: - * ` json `: marshals and unmarshals large json object, in several goroutines independently. - * ` http `: http client and server serving "hello world", uses persistent connections and read/write timeouts. - * ` garbage `: parses net package using go/parser, in a loop in several goroutines; half of packages are instantly discarded, the other half is preserved indefinitely; this creates significant pressure on the garbage collector. - * ` build `: does 'go build -a std'. - -# Metrics - -Metrics collected are: - * ` allocated `: amount of memory allocated, per iteration, in bytes - * ` allocs `: number of memory allocations, per iteration - * ` cputime `: total CPU time (user+sys from time Unix utility output), can be larger than time when GOMAXPROCS>1, per iteration, in ns - * ` gc-pause-one `: duration of a single garbage collector pause, in ns - * ` gc-pause-total `: total duration of garbage collector pauses, per iteration, ns - * ` latency-50/95/99 `: request latency percentile, in ns - * ` rss `: max memory consumption as reported by OS, in bytes - * ` sys-gc `: memory consumed by garbage collector metadata (` MemStats.GCSys `), in bytes - * ` sys-heap `: memory consumed by heap (` MemStats.HeapSys `), in bytes - * ` sys-other `: unclassified memory consumption (` MemStats.OtherSys `), in bytes - * ` sys-stack `: memory consumed by stacks (` MemStats.StackSys `), in bytes - * ` sys-total `: total memory allocated from OS (` MemStats.Sys `), in bytes - * ` time `: real time (essentially the same as std Go benchmarks output), per iteration, in ns - * ` virtual-mem `: virtual memory consumption as reported by OS, in bytes - -And for build benchmark: - * ` binary-size `: size of the go command, in bytes - * ` build-cputime `: CPU time spent on the build, in ns - * ` build-rss `: max memory consumption of the build process as reported by OS, in bytes - * ` build-time `: real time of the build, in ns - -# Profiles - -The dashboard also collects a set of profiles for every commit, they are available from the [details page](http://build.golang.org/perfdetail?commit=fb3d6c1631c3f3141f33a01afb4c0a23ef0ea2cf&commit0=82f48826c6c79a3d5697d5e06cac8451f3dc3c7f&kind=builder&builder=linux-amd64-perf&benchmark=http). For usual benchmarks [CPU](http://build.golang.org/log/b023711522ca6511f2c9bfb46cdfb511fd77e967) and [memory](http://build.golang.org/log/06bd072aa0dec4936a05b7aa13b9f906b6989865) profiles are collected. For build benchmark - [perf profile](http://build.golang.org/log/34c4f0c7b7ea3521e5356b91775a026607e72d44), [per-process split of CPU time](http://build.golang.org/log/da517b4f6892af8a6b4900dbe58311b665ced00f) and [per-section size](http://build.golang.org/log/fc4287d6a9e280bf35c572c038dbc4414d60bcf8). - -# Perf Changes View - -The [view](http://build.golang.org/perf) allows to see aggregate information about significant performance changes caused by recent commits. - -Rows: - * The first row shows difference between the latest release and tip. - * The rest of the rows show deltas caused by individual commits. - -Columns: - * The first column is commit hash. - * Second - number of benchmarks that were executed for the commit to far. - * Third - metric name, or the special 'failure' metric for build/runtime crashes. - * Fourth - negative deltas. - * Fifth - positive deltas. - * The rest describe commit. - -You can click on any positive/negative delta to see details about the change. diff --git a/Performance.md b/Performance.md index 5133d670..fa1db061 100644 --- a/Performance.md +++ b/Performance.md @@ -1,677 +1,4 @@ -# Debugging performance issues in Go programs +The Go wiki on GitHub has moved to go.dev (#61940). --- originally written by Dmitry Vyukov +Try or . -Let's assume you have a Go program and want to improve its performance. There -are several tools available that can help with this task. These tools can help -you to identify various types of hotspots (CPU, IO, memory), hotspots are the -places that you need to concentrate on in order to significantly improve -performance. However, another outcome is possible -- the tools can help you -identify obvious performance defects in the program. For example, you prepare an -SQL statement before each query while you could prepare it once at program -startup. Another example is if an O(N^2) algorithm somehow slipped into where an -obvious O(N) exists and is expected. In order to identify such cases you need to -sanity check what you see in profiles. For example for the first case -significant time spent in SQL statement preparation would be the red flag. - -It's also important to understand various bounding factors for performance. For -example, if the program communicates via 100 Mbps network link and it is already -utilizes >90Mbps, there is not much you can do with the program to improve its -performance. There are similar bounding factors for disk IO, memory consumption -and computational tasks. With that in mind we can look at the available tools. - -Note: The tools can interfere with each other. For example, precise memory -profiling skews CPU profiles, goroutine blocking profiling affects scheduler -trace, etc. Use tools in isolation to get more precise info. - -## CPU Profiler - -Go runtime contains built-in CPU profiler, which shows what functions consume -what percent of CPU time. There are 3 ways you can get access to it: - -1. The simplest one is -cpuprofile flag of 'go test' - (https://pkg.go.dev/cmd/go/#hdr-Description_of_testing_flags) command. For - example, the following command: - - $ go test -run=none -bench=ClientServerParallel4 -cpuprofile=cprof net/http - - will profile the given benchmark and write CPU profile into 'cprof' file. - Then: - - $ go tool pprof --text http.test cprof - - will print a list of the hottest functions. - - There are several output types available, the most useful ones are: - `--text`, `--web` and `--list`. Run `go tool pprof` to get the complete - list. The obvious drawback of this option is that it works only for tests. - -2. [net/http/pprof](https://pkg.go.dev/net/http/pprof): This is the ideal - solution for network servers. You merely need to import `net/http/pprof`, - and collect profiles with: - - $ go tool pprof --text mybin http://myserver:6060:/debug/pprof/profile - -3. Manual profile collection. You need to import - [runtime/pprof](https://pkg.go.dev/runtime/pprof/) and add the following - code to main function: - - if *flagCpuprofile != "" { - f, err := os.Create(*flagCpuprofile) - if err != nil { - log.Fatal(err) - } - pprof.StartCPUProfile(f) - defer pprof.StopCPUProfile() - } - - The profile will be written to the specified file, visualize it the same way - as in the first option. - -Here is an example of a profile visualized with `--web` option: -[cpu_profile.png] - -You can investigate a single function with `--list=funcname` option. For -example, the following profile shows that the time was spent in the `append` -function: - - . . 93: func (bp *buffer) WriteRune(r rune) error { - . . 94: if r < utf8.RuneSelf { - 5 5 95: *bp = append(*bp, byte(r)) - . . 96: return nil - . . 97: } - . . 98: - . . 99: b := *bp - . . 100: n := len(b) - . . 101: for n+utf8.UTFMax > cap(b) { - . . 102: b = append(b, 0) - . . 103: } - . . 104: w := utf8.EncodeRune(b[n:n+utf8.UTFMax], r) - . . 105: *bp = b[:n+w] - . . 106: return nil - . . 107: } - -There are also 3 special entries that the profiler uses when it can't unwind -stack: GC, System and ExternalCode. GC means time spent during garbage -collection, see Memory Profiler and Garbage Collector Trace sections below for -optimization suggestions. System means time spent in goroutine scheduler, stack -management code and other auxiliary runtime code. ExternalCode means time spent -in native dynamic libraries. - -Here are some hints with respect to how to interpret what you see in the -profile. - -If you see lots of time spent in `runtime.mallocgc` function, the program -potentially makes excessive amount of small memory allocations. The profile will -tell you where the allocations are coming from. See the memory profiler section -for suggestions on how to optimize this case. - -If lots of time is spent in channel operations, sync.Mutex code and other -synchronization primitives or System component, the program probably suffers -from contention. Consider to restructure program to eliminate frequently -accessed shared resources. Common techniques for this include -sharding/partitioning, local buffering/batching and copy-on-write technique. - -If lots of time is spent in `syscall.Read/Write`, the program potentially makes -excessive amount of small reads and writes. Bufio wrappers around os.File or -net.Conn can help in this case. - -If lots of time is spent in GC component, the program either allocates too many -transient objects or heap size is very small so garbage collections happen too -frequently. See Garbage Collector Tracer and Memory Profiler sections for -optimization suggestions. - -Note: For darwin CPU profiler currently only [works on El Capitan or newer](https://code.google.com/p/go/issues/detail?id=6047). - -Note: On windows you need to install Cygwin, Perl and Graphviz to generate -svg/web profiles. - - -## Memory Profiler - -Memory profiler shows what functions allocate heap memory. You can collect it in -similar ways as CPU profile: with `go test --memprofile` -(https://pkg.go.dev/cmd/go/#hdr-Description_of_testing_flags), with -[net/http/pprof](https://pkg.go.dev/net/http/pprof) via -http://myserver:6060:/debug/pprof/heap or by calling -[runtime/pprof.WriteHeapProfile](https://pkg.go.dev/runtime/pprof/#WriteHeapProfile). - -You can visualize only allocations live at the time of profile collection -(`--inuse_space flag to pprof`, default), or all allocations happened since -program start (`--alloc_space` flag to `pprof`). The former is useful for -profiles collected with net/http/pprof on live applications, the latter is -useful for profiles collected at program end (otherwise you will see almost -empty profile). - -Note: the memory profiler is sampling, that is, it collects information only -about some subset of memory allocations. Probability of sampling an object is -proportional to its size. You can change the sampling rate with go test -`--memprofilerate` flag, or by setting `runtime.MemProfileRate` variable at -program startup. The rate of 1 will lead to collection of information about all -allocations, but it can slow down execution. The default sampling rate is 1 -sample per 512KB of allocated memory. - -You can also visualize number of bytes allocated or number of objects allocated -(`--inuse/alloc_space` and `--inuse/alloc_objects` flags, respectively). The -profiler tends to sample larger objects during profiling more. But it's -important to understand that large objects affect memory consumption and GC -time, while large number of tiny allocations affects execution speed (and GC -time to some degree as well). So it may be useful to look at both. - -Objects can be persistent or transient. If you have several large persistent -objects allocated at program start, they will be most likely sampled by the -profiler (because they are large). Such objects do affect memory consumption and -GC time, but they do not affect normal execution speed (no memory management -operations happen on them). On the other hand if you have large number of -objects with very short life durations, they can be barely represented in the -profile (if you use the default `--inuse_space mode`). But they do significantly -affect execution speed, because they are constantly allocated and freed. So, -once again, it may be useful to look at both types of objects. So, generally, if -you want to reduce memory consumption, you need to look at `--inuse_space` -profile collected during normal program operation. If you want to improve -execution speed, look at `--alloc_objects` profile collected after significant -running time or at program end. - -There are several flags that control reporting granularity. `--functions` makes -pprof report on function level (default). `--lines` makes pprof report on source -line level, which is useful if hot functions allocate on different lines. And -there are also `--addresses` and `--files` for exact instruction address and -file level, respectively. - -There is a useful option for the memory profile -- you can look at it right in -the browser (provided that you imported `net/http/pprof`). If you open -http://myserver:6060/debug/pprof/heap?debug=1 you must see the heap profile -along the lines of: - - heap profile: 4: 266528 [123: 11284472] @ heap/1048576 - 1: 262144 [4: 376832] @ 0x28d9f 0x2a201 0x2a28a 0x2624d 0x26188 0x94ca3 0x94a0b 0x17add6 0x17ae9f 0x1069d3 0xfe911 0xf0a3e 0xf0d22 0x21a70 - # 0x2a201 cnew+0xc1 runtime/malloc.goc:718 - # 0x2a28a runtime.cnewarray+0x3a runtime/malloc.goc:731 - # 0x2624d makeslice1+0x4d runtime/slice.c:57 - # 0x26188 runtime.makeslice+0x98 runtime/slice.c:38 - # 0x94ca3 bytes.makeSlice+0x63 bytes/buffer.go:191 - # 0x94a0b bytes.(*Buffer).ReadFrom+0xcb bytes/buffer.go:163 - # 0x17add6 io/ioutil.readAll+0x156 io/ioutil/ioutil.go:32 - # 0x17ae9f io/ioutil.ReadAll+0x3f io/ioutil/ioutil.go:41 - # 0x1069d3 godoc/vfs.ReadFile+0x133 godoc/vfs/vfs.go:44 - # 0xfe911 godoc.func·023+0x471 godoc/meta.go:80 - # 0xf0a3e godoc.(*Corpus).updateMetadata+0x9e godoc/meta.go:101 - # 0xf0d22 godoc.(*Corpus).refreshMetadataLoop+0x42 godoc/meta.go:141 - - 2: 4096 [2: 4096] @ 0x28d9f 0x29059 0x1d252 0x1d450 0x106993 0xf1225 0xe1489 0xfbcad 0x21a70 - # 0x1d252 newdefer+0x112 runtime/panic.c:49 - # 0x1d450 runtime.deferproc+0x10 runtime/panic.c:132 - # 0x106993 godoc/vfs.ReadFile+0xf3 godoc/vfs/vfs.go:43 - # 0xf1225 godoc.(*Corpus).parseFile+0x75 godoc/parser.go:20 - # 0xe1489 godoc.(*treeBuilder).newDirTree+0x8e9 godoc/dirtrees.go:108 - # 0xfbcad godoc.func·002+0x15d godoc/dirtrees.go:100 - -The numbers in the beginning of each entry `("1: 262144 [4: 376832]")` represent -number of currently live objects, amount of memory occupied by live objects, -total number of allocations and amount of memory occupied by all allocations, -respectively. - -Optimizations are usually application-specific, but here are some common -suggestions. - -1. Combine objects into larger objects. For example, replace `*bytes.Buffer` - struct member with `bytes.Buffer` (you can preallocate buffer for writing by - calling `bytes.Buffer.Grow` later). This will reduce number of memory - allocations (faster) and also reduce pressure on garbage collector (faster - garbage collections). - -2. Local variables that escape from their declaration scope get promoted into - heap allocations. Compiler generally can't prove that several variables have - the same life time, so it allocates each such variable separately. So you - can use the above advise for local variables as well. For example, replace: - - for k, v := range m { - k, v := k, v // copy for capturing by the goroutine - go func() { - // use k and v - }() - } - - with: - - for k, v := range m { - x := struct{ k, v string }{k, v} // copy for capturing by the goroutine - go func() { - // use x.k and x.v - }() - } - - This replaces two memory allocations with a single allocation. However, this - optimization usually negatively affects code readability, so use it - reasonably. - -3. A special case of allocation combining is slice array preallocation. If you - know a typical size of the slice, you can preallocate a backing array for it - as follows: - - type X struct { - buf []byte - bufArray [16]byte // Buf usually does not grow beyond 16 bytes. - } - - func MakeX() *X { - x := &X{} - // Preinitialize buf with the backing array. - x.buf = x.bufArray[:0] - return x - } - -4. If possible use smaller data types. For example, use `int8` instead of - `int`. - -5. Objects that do not contain any pointers (note that strings, slices, maps - and chans contain implicit pointers), are not scanned by garbage collector. - For example, a 1GB byte slice virtually does not affect garbage collection - time. So if you remove pointers from actively used objects, it can - positively impact garbage collection time. Some possibilities are: replace - pointers with indices, split object into two parts one of which does not - contain pointers. - -6. Use freelists to reuse transient objects and reduce number of allocations. - Standard library contains [sync.Pool](http://tip.golang.org/pkg/sync/#Pool) - type that allows to reuse the same object several times in between garbage - collections. However, be aware that, as any manual memory management scheme, - incorrect use of sync.Pool can lead to use-after-free bugs. - -You can also use the Garbage Collector Trace (see below) to get some insights -into memory issues. - -TODO(dvyukov): mention that stats are updated in a deferred way: "Memprof stats -are updated in a deferred way. This is required in order to present a consistent -picture in the situation when allocs are coming continuously and frees are -coming in batches afterwards. Several consecutive GCs push the update pipeline -forward. That's what you observe. So if you profile a live server then any -sample will give you a consistent snapshot. However, if the program completes -some activity and you want to collect the snapshot after this activity, then you -need to execute 2 or 3 GCs before the collection." - -## Blocking Profiler - -The blocking profiler shows where goroutine block waiting on synchronization -primitives (including timer channels). You can collect it in similar ways as CPU -profile: with `go test --blockprofile` -(https://pkg.go.dev/cmd/go/#hdr-Description_of_testing_flags), with -[net/http/pprof](https://pkg.go.dev/net/http/pprof) via -http://myserver:6060:/debug/pprof/block or by calling -[runtime/pprof.Lookup("block").WriteTo](https://pkg.go.dev/runtime/pprof/#Profile.WriteTo). - -But there is significant caveat -- the blocking profiler is not enabled by -default. `go test --blockprofile` will enable it for you automatically. However, -if you use `net/http/pprof` or `runtime/pprof`, you need to enable it manually -(otherwise the profile will be empty). To enable the blocking profiler call -[runtime.SetBlockProfileRate](https://pkg.go.dev/runtime/#SetBlockProfileRate). -SetBlockProfileRate controls the fraction of goroutine blocking events that are -reported in the blocking profile. The profiler aims to sample an average of one -blocking event per the specified amount of nanoseconds spent blocked. To include -every blocking event in the profile, set the rate to 1. - -If a function contains several blocking operations and it's not obvious which -one leads to blocking, use `--lines` flag to pprof. - -Note that not all blocking is bad. When a goroutine blocks, the underlying -worker thread simply switches to another goroutine. So blocking in the -cooperative Go environment is very different from blocking on a mutex in a -non-cooperative systems (e.g. typical C++ or Java threading libraries, where -blocking leads to thread idling and expensive thread context switches). To give -you some feeling, let's consider some examples. - -Blocking on a time.Ticker is usually OK. If a goroutine blocks on a Ticker for -10 seconds, you will see 10 seconds of blocking in the profile, which is -perfectly fine. Blocking on `sync.WaitGroup` is frequently OK. For example, is a -task takes 10 seconds, the goroutine waiting on a WaitGroup for completion will -account for 10 seconds of blocking in the profile. Blocking on sync.Cond may or -may not be OK, depending on the situation. Consumer blocking on a channel -suggests slow producers or lack of work. Producer blocking on a channel suggests -that consumers are slower, but this is frequently OK. Blocking on a -channel-based semaphore shows how much goroutines are gated on the semaphore. -Blocking on a sync.Mutex or sync.RWMutex is usually bad. You can use `--ignore` -flag to pprof to exclude known uninteresting blocking from a profile during -visualization. - -Blocking of goroutines can lead to two negative consequences: - -1. Program does not scale with processors due to lack of work. Scheduler Trace - can help to identify this case. - -2. Excessive goroutine blocking/unblocking consumes CPU time. CPU Profiler can - help to identify this case (look at the System component). - -Here are some common suggestions that can help to reduce goroutine blocking: - -1. Use sufficiently buffered channels in producer-consumer scenarios. - Unbuffered channels substantially limit available parallelism in the - program. - -2. Use `sync.RWMutex` instead of `sync.Mutex` for read-mostly workloads. - Readers never block other readers in `sync.RWMutex`, even on implementation - level. - -3. In some cases it's possible to remove mutexes entirely by using - copy-on-write technique. If the protected data structure is modified - infrequently and it's feasible to make copies of it, then it can be updated - as follows: - - type Config struct { - Routes map[string]net.Addr - Backends []net.Addr - } - - var config atomic.Value // actual type is *Config - - // Worker goroutines use this function to obtain the current config. - // UpdateConfig must be called at least once before this func. - func CurrentConfig() *Config { - return config.Load().(*Config) - } - - // Background goroutine periodically creates a new Config object - // as sets it as current using this function. - func UpdateConfig(cfg *Config) { - config.Store(cfg) - } - - This pattern prevents the writer from blocking readers during update. - -4. Partitioning is another general technique for reducing contention/blocking - on shared mutable data structures. Below is an example of how to partition a - hashmap: - - type Partition struct { - sync.RWMutex - m map[string]string - } - - const partCount = 64 - var m [partCount]Partition - - func Find(k string) string { - idx := hash(k) % partCount - part := &m[idx] - part.RLock() - v := part.m[k] - part.RUnlock() - return v - } - -5. Local caching and batching of updates can help to reduce contention on - un-partitionable data structures. Below you can see how to batch sends to a - channel: - - const CacheSize = 16 - - type Cache struct { - buf [CacheSize]int - pos int - } - - func Send(c chan [CacheSize]int, cache *Cache, value int) { - cache.buf[cache.pos] = value - cache.pos++ - if cache.pos == CacheSize { - c <- cache.buf - cache.pos = 0 - } - } - - This technique is not limited to channels. It can be used to batch updates - to a map, batch allocations, etc. - -6. Use [sync.Pool](http://tip.golang.org/pkg/sync/#Pool) for freelists instead - of chan-based or mutex-protected freelists. sync.Pool uses smart techniques - internally to reduce blocking. - -## Goroutine Profiler - -The goroutine profiler simply gives you current stacks of all live goroutines in -the process. It can be handy to debug load balancing issues (see Scheduler Trace -section below), or to debug deadlocks. The profile makes sense only for a -running app, so go test does not expose it. You can collect the profile with -[net/http/pprof](https://pkg.go.dev/net/http/pprof) via -http://myserver:6060:/debug/pprof/goroutine, and visualize it to svg/pdf or by -calling -[runtime/pprof.Lookup("goroutine").WriteTo](https://pkg.go.dev/runtime/pprof/#Profile.WriteTo). -But the most useful way is to type -http://myserver:6060:/debug/pprof/goroutine?debug=2 in your browser, which will -give you symbolized stacks similar to what you see when a program crashes. Note -that goroutines in "syscall" state consume an OS thread, other goroutines do not -(except for goroutines that called runtime.LockOSThread, which is, -unfortunately, not visible in the profile). Note that goroutines in "IO wait" -state also do not consume threads, they are parked on non-blocking network -poller (which uses epoll/kqueue/GetQueuedCompletionStatus to unpark goroutines -later). - -## Garbage Collector Trace - -Aside from the profiling tools, there is another kind of tools available -- -tracers. They allow to trace garbage collections, memory allocator and goroutine -scheduler state. To enable the garbage collector (GC) trace, run the program -with `GODEBUG=gctrace=1` environment variable: - - $ GODEBUG=gctrace=1 ./myserver - -Then the program will print output similar to the following during execution: - - gc9(2): 12+1+744+8 us, 2 -> 10 MB, 108615 (593983-485368) objects, 4825/3620/0 sweeps, 0(0) handoff, 6(91) steal, 16/1/0 yields - gc10(2): 12+6769+767+3 us, 1 -> 1 MB, 4222 (593983-589761) objects, 4825/0/1898 sweeps, 0(0) handoff, 6(93) steal, 16/10/2 yields - gc11(2): 799+3+2050+3 us, 1 -> 69 MB, 831819 (1484009-652190) objects, 4825/691/0 sweeps, 0(0) handoff, 5(105) steal, 16/1/0 yields - -Let's consider the meaning of these numbers. One line per GC is printed. The -first number ("gc9") is the number of GC (this is the 9-th GC since program -start). The number in parens ("(2)") is the number of worker threads -participated in the GC. The next 4 numbers ("12+1+744+8 us") mean -stop-the-world, sweeping, marking and waiting for worker threads to finish, in -microseconds, respectively. The next 2 numbers ("2 -> 10 MB") mean size of live -heap after the previous GC and full heap size (including garbage) before the -current GC. The next 3 numbers ("108615 (593983-485368) objects") are total -number of objects in heap (including garbage) and total number of memory -allocation and free operations. The next 3 numbers ("4825/3620/0 sweeps") -characterize sweep phase (of the previous GC): there were total 4825 memory -spans, 3620 were swept on demand or in background, 0 were swept during -stop-the-world phase (the rest were unused spans). The next 4 numbers ("0(0) -handoff, 6(91) steal") characterize load balancing during parallel mark phase: -there were 0 object handoff operations (0 objects were handoff), and 6 steal -operations (91 objects were stolen). The last 3 numbers ("16/1/0 yields") -characterize effectiveness of parallel mark phase: there were total of 17 yield -operations during waiting for another thread. - -The GC is [mark-and-sweep -type](http://www.brpreiss.com/books/opus5/html/page424.html). Total GC can be -expressed as: - - Tgc = Tseq + Tmark + Tsweep - -where Tseq is time to stop user goroutines and some preparation activities -(usually small); Tmark is heap marking time, marking happens when all user -goroutines are stopped, and thus can significantly affect latency of processing; -Tsweep is heap sweeping time, sweeping generally happens concurrently with -normal program execution, and so is not so critical for latency. - -Marking time can be approximately expressed as: - - Tmark = C1*Nlive + C2*MEMlive_ptr + C3*Nlive_ptr - -where Nlive is the number of live objects in the heap during GC, `MEMlive_ptr` -is the amount of memory occupied by live objects with pointers, `Nlive_ptr` is -the number of pointers in live objects. - -Sweeping time can be approximately expressed as: - - Tsweep = C4*MEMtotal + C5*MEMgarbage - -where `MEMtotal` is the total amount of heap memory, `MEMgarbage` is the amount -of garbage in the heap. - -Next GC happens after the program has allocated an extra amount of memory -proportional to the amount already in use. The proportion is controlled by GOGC -environment variable (100 by default). If GOGC=100 and the program is using 4M -of heap memory, runtime will trigger GC again when the program gets to 8M. This -keeps the GC cost in linear proportion to the allocation cost. Adjusting GOGC -changes the linear constant and also the amount of extra memory used. - -Only sweeping depends on total size of the heap, and sweeping happens -concurrently with normal program execution. So it can make sense to set GOGC to -a higher value (200, 300, 500, etc) if you can afford extra memory consumption. -For example, GOGC=300 can reduce garbage collection overhead by up to 2 times -while keeping latencies the same (at the cost of 2 times larger heap). - -GC is parallel and generally scales well with hardware parallelism. So it can -make sense to set GOMAXPROCS to higher value even for sequential programs just -to speed up garbage collections. However, note that number of garbage collector -threads is currently bounded by 8. - -## Memory Allocator Trace - -Memory allocator traces simply dumps all memory allocation and free operations -onto console. It's enabled with GODEBUG=allocfreetrace=1 environment variable. -The output looks along the lines of: - - tracealloc(0xc208062500, 0x100, array of parse.Node) - goroutine 16 [running]: - runtime.mallocgc(0x100, 0x3eb7c1, 0x0) - runtime/malloc.goc:190 +0x145 fp=0xc2080b39f8 - runtime.growslice(0x31f840, 0xc208060700, 0x8, 0x8, 0x1, 0x0, 0x0, 0x0) - runtime/slice.goc:76 +0xbb fp=0xc2080b3a90 - text/template/parse.(*Tree).parse(0xc2080820e0, 0xc208023620, 0x0, 0x0) - text/template/parse/parse.go:289 +0x549 fp=0xc2080b3c50 - ... - - tracefree(0xc208002d80, 0x120) - goroutine 16 [running]: - runtime.MSpan_Sweep(0x73b080) - runtime/mgc0.c:1880 +0x514 fp=0xc20804b8f0 - runtime.MCentral_CacheSpan(0x69c858) - runtime/mcentral.c:48 +0x2b5 fp=0xc20804b920 - runtime.MCache_Refill(0x737000, 0xc200000012) - runtime/mcache.c:78 +0x119 fp=0xc20804b950 - ... - -The trace contains address of the memory block, size, type, goroutine id and the -stack trace. It's probably more useful for debugging, but can give very -fine-grained info for allocation optimizations as well. - -## Scheduler Trace - -Scheduler trace can provide insights into dynamic behavior of the goroutine -scheduler and allow to debug load balancing and scalability issues. To enable -the scheduler trace trace, run the program with GODEBUG=schedtrace=1000 -environment variable (the value means period of output, in ms, in this case it's -once per second): - - $ GODEBUG=schedtrace=1000 ./myserver - -Then the program will print output similar to the following during execution: - - SCHED 1004ms: gomaxprocs=4 idleprocs=0 threads=11 idlethreads=4 runqueue=8 [0 1 0 3] - SCHED 2005ms: gomaxprocs=4 idleprocs=0 threads=11 idlethreads=5 runqueue=6 [1 5 4 0] - SCHED 3008ms: gomaxprocs=4 idleprocs=0 threads=11 idlethreads=4 runqueue=10 [2 2 2 1] - -The first number ("1004ms") is time since program start. Gomaxprocs is the -current value of GOMAXPROCS. Idleprocs is the number of idling processors (the -rest are executing Go code). Threads is the total number of worker threads -created by the scheduler (threads can be in 3 states: execute Go code -(gomaxprocs-idleprocs), execute syscalls/cgocalls or idle). Idlethreads is the -number of idling worker threads. Runqueue is the length of global queue with -runnable goroutines. The numbers in square brackets ("[0 1 0 3]") are lengths of -per-processor queues with runnable goroutines. Sum of lengths of global and -local queues represents the total number of goroutines available for execution. - -Note: You can combine any of the tracers as -GODEBUG=gctrace=1,allocfreetrace=1,schedtrace=1000. - -Note: There is also detailed scheduler trace, which you can enable with -GODEBUG=schedtrace=1000,scheddetail=1. It prints detailed info about every -goroutine, worker thread and processor. We won't describe its format here as -it's mainly useful for scheduler developers; but you can find details in -[src/pkg/runtime/proc.c](https://code.google.com/p/go/source/browse/src/pkg/runtime/proc.c). - -The scheduler trace is useful when a program does not scale linearly with -GOMAXPROCS and/or does not consume 100% of CPU time. The ideal situation is when -all processors are busy executing Go code, number of threads is reasonable, -there is plenty of work in all queues and the work is reasonably evenly -distributed: - - gomaxprocs=8 idleprocs=0 threads=40 idlethreads=5 runqueue=10 [20 20 20 20 20 20 20 20] - -A bad situation is when something of the above does not hold. For example the -following sample demonstrates shortage of work to keep all processors busy: - - gomaxprocs=8 idleprocs=6 threads=40 idlethreads=30 runqueue=0 [0 2 0 0 0 1 0 0] - -Note: use OS-provided means to measure actual CPU utilization as the ultimate -characteristic. On Unix family of operating system it is top command; on Windows -it is Task Manager. - -You can use the goroutine profiler to understand where goroutines block in the -case of work shortage. Note that load imbalance is not ultimately bad as long as -all processors are busy, it will just cause some moderate load balancing -overheads. - -## Memory Statistics - -Go runtime exposes coarse-grained memory statistics via -[runtime.ReadMemStats](https://pkg.go.dev/runtime/#ReadMemStats) function. -The statistics are also exposed via net/http/pprof at the bottom of -http://myserver:6060/debug/pprof/heap?debug=1. The statistics are described -[here](https://pkg.go.dev/runtime/#MemStats). Some of the interesting fields -are: - -1. HeapAlloc - current heap size. -2. HeapSys - total heap size. -3. HeapObjects - total number of objects in the heap. -4. HeapReleased - amount of memory released to the OS; runtime releases to the - OS memory unused for 5 minutes, you can force this process with - runtime/debug.FreeOSMemory. -5. Sys - total amount of memory allocated from OS. -6. Sys-HeapReleased - effective memory consumption of the program. -7. StackSys - memory consumed for goroutine stacks (note that some stacks are - allocated from heap and are not accounted here, unfortunately there is no - way to get total size of stacks - (https://code.google.com/p/go/issues/detail?id=7468)). -8. MSpanSys/MCacheSys/BuckHashSys/GCSys/OtherSys - amount of memory allocated - by runtime for various auxiliary purposes; they are generally not - interesting, unless they are too high. -9. PauseNs - durations of last garbage collections. - -## Heap Dumper - -The last available tool is heap dumper, it can write state of the whole heap -into a file for future exploration. It can be useful for identifying memory -leaks and getting insights into program memory consumption. - -First, you need to write the dump using -[runtime/debug.WriteHeapDump](http://tip.golang.org/pkg/runtime/debug/#WriteHeapDump) -function: - - f, err := os.Create("heapdump") - if err != nil { ... } - debug.WriteHeapDump(f.Fd()) - -Then you can either render it to a dot file with graphical representation of the -heap or convert it to hprof format. To render it to a dot file: - - $ go get github.com/randall77/hprof/dumptodot - $ dumptodot heapdump mybinary > heap.dot - -and open `heap.dot` with Graphviz. - -To convert it to `hprof` format: - - $ go get github.com/randall77/hprof/dumptohprof - $ dumptohprof heapdump heap.hprof - $ jhat heap.hprof - -and navigate your browser to http://myserver:7000. - -## Concluding Remarks - -Optimization is an open problem, there are simple recipes that you can use to -improve performance. Sometimes optimization requires complete re-architecture of -the program. But we hope that the tools will be a valuable addition to your -toolbox, that you can use to at least analyze and understand what happens. -[Profiling Go Programs](https://go.dev/blog/profiling-go-programs) is a good -tutorial on usage of CPU and memory profilers to optimize a simple program. diff --git a/Plan9.md b/Plan9.md index 851210e4..506431d1 100644 --- a/Plan9.md +++ b/Plan9.md @@ -1,178 +1,4 @@ -# Introduction +The Go wiki on GitHub has moved to go.dev (#61940). -An experimental port of [Go](https://golang.org) is available for the [Plan 9 from Bell Labs](https://9p.io/plan9) operating system. +Try or . -# Supported architectures - -The Plan 9 port of Go is available for the following architectures: - -* 386 -* amd64 -* arm - -# Supported kernels - -The current Go distribution has been tested successfully on: - -* [Plan 9 from Bell Labs](https://9p.io/plan9) (386 and arm) kernel -* [9front](http://9front.org) amd64 kernel -* Bell Labs [9k](https://github.com/0intro/plan9-contrib/tree/master/sys/src/9k) (amd64) kernel - -# Requirements - -Go on Plan 9 requires a kernel providing the following system calls: - -* tsemacquire (available since [2012-06-30](https://github.com/0intro/plan9/commit/6c1d8fd563a815cbbac06f61bdc1d0f6331c3d3b)) -* nsec (available since [2014-05-15](https://github.com/0intro/plan9/commit/bd0c9332d5b1da1371d03e8e0ad03de0d08e08c6)) - -A fix to the pread system call is required, so pread will not update the channel offset when reading a file: - -* [9-pread-offset](http://9legacy.org/9legacy/patch/9-pread-offset.diff) - -The TCP connection control file must handle the "close" message to be able close a TCP connection gracefully, while waking up the readers: - -* [9-tcp-close](http://9legacy.org/9legacy/patch/9-tcp-close.diff) - -A fix to Fossil is required to increment Qid.vers after a wstat, so a truncate followed by a read will return the content of the new file instead of the cached content. - -* [fossil-wstat-qid](http://9legacy.org/9legacy/patch/fossil-wstat-qid.diff) - -You will need support for SHA-2 signatures in X.509 certificates, so you could download sources from repositories hosted on GoogleSource, GitHub and so on. - -* [libsec-x509-sha2](http://9legacy.org/9legacy/patch/libsec-x509-sha2.diff) - -If you're running Plan 9 on Raspberry Pi, you'll require the latest [bcm](https://9p.io/sources/contrib/miller/9/bcm) kernel from Richard Miller. - -CA certificates for `crypto/x509` package needs to be installed at `/sys/lib/tls/ca.pem`. You can download it from `https://curl.haxx.se/ca/cacert.pem` or copy from another system. - -For 9front, you may need to configure loopback addresses for standard library tests: - - ip/ipconfig -P loopback /dev/null 127.1 - ip/ipconfig -P loopback /dev/null ::1 - -# Installation - -Since Go is written in Go, you may want to bootstrap Go with Go 1.4.3, which is the latest release of Go written in C. - -However, since the Go 1.4 runtime wasn't mature enough on Plan 9, we recommend you to bootstrap from a more recent version of Go, using another operating system. - -## Bootstrapping from Plan 9 - -First, install Go 1.4: - - -```sh -cd /tmp -git clone -b go1.4.3 https://go.googlesource.com/go go1.4 -cd go1.4/src -hget http://9legacy.org/go/patch/syscall-exec.diff | ape/patch -p2 -make.rc -``` - -The [syscall-exec](http://9legacy.org/go/patch/syscall-exec.diff) patch is required if you're running a machine with SMP enabled. - -Then, set the `GOROOT_BOOTSTRAP` environment variable: - -```sh -GOROOT_BOOTSTRAP=/tmp/go1.4 -``` - -Finally, install the latest version of Go: - -```sh -cd /tmp -git clone https://go.googlesource.com/go -cd go/src -all.rc -bind -a /tmp/go/bin /bin -``` -Go is now ready to use. - -## Bootstrapping from another operating system - -First, you must have installed Go on this operating system, following the [Go installation instructions](https://go.dev/doc/install). - -Then, you can cross-compile a Go toolchain for Plan 9: - -```shb -cd $GOROOT/src -GOOS=plan9 GOARCH=386 ./bootstrap.bash -``` - -Then, the bootstrap toolchain will be available in `../../go-plan9-386-bootstrap.tbz`. - -Finally, you can extract this archive to your Plan 9 machine. - -For example: - -```sh -cd /tmp -tar xzf go-plan9-386-bootstrap.tbz -bind -a /tmp/go-plan9-386-bootstrap/bin /bin -``` - -Go is now ready to use. - -You'll be able to use this installation of Go to bootstrap future Go releases, by setting the `GOROOT_BOOTSTRAP` environment variable: - -```sh -GOROOT_BOOTSTRAP=/tmp/go-plan9-386-bootstrap -``` - -## Bootstraping from binaries - -A [binary package](https://storage.googleapis.com/go-builder-data/gobootstrap-plan9-386.tar.gz) for plan9/386 is available. - -This binary package is used to bootstrap Go on the plan9/386 builder. - -```sh -cd /tmp -hget -o gobootstrap-plan9-386.tar.gz https://storage.googleapis.com/go-builder-data/gobootstrap-plan9-386.tar.gz -mkdir gobootstrap-plan9-386 -cd gobootstrap-plan9-386 -tar xzf ../gobootstrap-plan9-386.tar.gz -``` - -You'll be able to use this binary package of Go to bootstrap Go, by setting the `GOROOT_BOOTSTRAP` environment variable: - -```sh -GOROOT_BOOTSTRAP=/tmp/gobootstrap-plan9-386 -``` - -Other binary packages are available [here](http://9legacy.org/download.html) and [here](https://github.com/fhs/go-plan9-binaries). - -# Git - -Git is not available on Plan 9. However a [Git wrapper](http://9legacy.org/9legacy/tools/git) is available as a simple rc script. It includes everything you need to use the [go](https://pkg.go.dev/cmd/go) tool. - -# Builders - -Three Plan 9 builders are currently running and reporting the results to the [Go Dashboard](http://build.golang.org/): - -* plan9-386 is running Plan 9 from Bell Labs (386 kernel) on a virtual machine -* plan9-amd64-9front is running Plan 9 from Bell Labs (amd64 kernel) on a virtual machine -* plan9-arm is running Plan 9 from Bell Labs (arm kernel) on a Raspberry Pi 3 - -# Status - -The Plan 9 port of Go is considered experimental and is still a work-in-progress. There is a number of known issues available on the [Go issue tracker](https://go.dev/issues). - -# Issues - -Many issues are currently open on the [Go issue tracker](https://go.dev/issues) with the [OS-Plan9](https://github.com/golang/go/issues?q=is%3Aopen+is%3Aissue+label%3AOS-Plan9) label. - -# Help - -The Plan 9 port of Go is a community-driven port. Any help to improve the Go port on Plan 9 would be highly appreciated. - -# Maintainer - -Many people have contributed to the Plan 9 port of Go. Since December 2013, the Plan 9 port of Go is maintained by [David du Colombier](https://github.com/0intro). - -# Trivia - -Many parts of Go are directly influenced by the Plan 9 system, as two of its three main designers worked on Plan 9 at Bell labs. Some of these connections are: -* The [Gopher](https://go.dev/doc/faq#gopher) is designed by Renée French, who also designed Glenda, the Plan 9 bunny. -* The Gc compiler hosted in this repository uses a [Plan 9-style loader](https://go.dev/doc/faq#What_compiler_technology_is_used_to_build_the_compilers). -* [Go's Assembler](https://go.dev/doc/asm) is based on Plan 9's syntax. The Go 1.x stack-based ABI is borrowed from Plan 9. -* Although not recommended, there was also some support for [[Plan 9 C|GcToolchainTricks]], with the original standard library being descended from Plan 9's libc. The [self-hosting design document](https://docs.google.com/document/d/1P3BLR31VA8cvLJLfMibSuTdwTuF7WWLux71CYD0eeD8) talks about this history. diff --git a/Podcasts.md b/Podcasts.md index a112532a..35f36c2e 100644 --- a/Podcasts.md +++ b/Podcasts.md @@ -1,29 +1,4 @@ -## Active podcast shows -* [Go Time](http://gotime.fm) - Erik St. Martin, Carlisia Campos, Brian Ketelsen, recorded weekly and streamed live at 3PM EST at http://changelog.com/live -* [go podcast()](https://go.transistor.fm/) - Dominic St-Pierre, recorded bi-weekly, ~15 minutes, topic based. -* [Cup o' Go](https://cupogo.dev/) - Stay up to date with the Go community in about 15 minutes per week. +The Go wiki on GitHub has moved to go.dev (#61940). -## Inactive podcast shows -* [GolangShow](http://golangshow.com/) – Weekly podcast since June 2015, in English and Russian languages. -* [Go Gab](https://www.briefs.fm/go-gab) - A podcast about everything Go. Episodes are short: about 3 minutes each. -* [GoFr](https://soundcloud.com/arnaud-assad/sets/gofr) – by Arnaud Assad, Sebastien Friess, Thomas Perez, Lucille Tachet in French. +Try or . - -## Podcast episodes -A collection of podcast episodes that cover Go programming. Please keep items in reverse chronological order (most recent first) -* [Working in the Go ecosystem - Dot Tech by Form3](https://techpodcast.form3.tech/episodes/ep-6-tech-working-in-the-go-ecosystem-with-bartomiej-klimczak) _2021-02-19_ -* [Making an Open Source Go project a full time job - Dot Tech by Form3](https://techpodcast.form3.tech/episodes/ep-2-tech-making-an-open-source-go-project-a-full-time-job-with-ashley-jeffs2) _2020-11-25_ -* [How and why you should move to Go - Dot Tech by Form3](https://techpodcast.form3.tech/episodes/ep-1-tech-how-and-why-you-should-move-to-go-with-johan-brandhorst-andy-kuszyk) _2020-11-03_ -* [The Go Language - Hipsters #67](https://hipsters.tech/linguagem-go-hipsters-67/) (_in portuguese_) _2017-10-24_ -* [The Go Programming Language 2 - Castálio Podcast #87](http://castalio.info/episodio-87-linguagem-de-programacao-go-parte-2.html) (_in portuguese_) _2017-02-13_ -* [The Go Programming Language 1 - Castálio Podcast #86](http://castalio.info/episodio-86-linguagem-de-programacao-go-parte-1.html) (_in portuguese_) _2017-02-06_ -* [Little chat about Go Lang](https://soundcloud.com/rdshipit/capycast-2-golang) (_in portuguese_) _2016-03-27_ -* [Programming in Go with Michael Van Sickle](https://www.dotnetrocks.com/?show=1203) _2015-10-13_ -* [Go on the Web](http://thewebplatform.libsyn.com/55-go-on-the-web) _2015-08-05_ -* [Fatherhood with Andrew Gerrand](http://beatsryetypes.com/episodes/2015/05/18/episode-16-fatherhood-with-andrew-gerrand.html) _2015-05-15_ -* [Talking with Go Developers at GopherCon India 2015](https://soundcloud.com/thenewstackanalysts/show-33-gophercon-india-2015) _2015-04-01_ -* [Interview with CC4CS talking about Security in Go](https://go.unicorn.tv/podcasts/interview-with-cc4cs-talking-about-security-in-go) _2015-03-06_ -* [Golang Best Practices](https://go.unicorn.tv/podcasts/golang-best-practices) _2014-09-08_ -* [An Introduction to the Go Programming Language with Andrew Gerrand](http://hanselminutes.com/416/an-introduction-to-the-go-programming-language-with-andrew-gerrand) _2014-03-28_ -* [FLOSS Weekly #284: The Go Language](https://twit.tv/shows/floss-weekly/episodes/284) _2014-02-19_ -* [Series: The Go Language - GrokPodcast](http://www.grokpodcast.com/series/a-linguagem-go/) (_in portuguese_) _2013-07-17_ \ No newline at end of file diff --git a/PortingPolicy.md b/PortingPolicy.md index ea64a781..ddd83325 100644 --- a/PortingPolicy.md +++ b/PortingPolicy.md @@ -1,96 +1,4 @@ -# Introduction +The Go wiki on GitHub has moved to go.dev (#61940). -This document is about the policy for adding a new port to the main Go repository. By port we mean an operating system + architecture combination, such as linux/386. +Try or . -The goal of this policy is to clarify what the Go project tries to promise for ports and to avoid the accumulation of incomplete or broken ports. - -# Requirements for a new port - -Before any code relating to a port can be added to the main Go repository, the following must all be done: - - * A [proposal](https://go.dev/s/proposal) must be filed and accepted in which the Go team accepts overall responsibility for having the new port in the core Go tree. In general, each new port carries an upkeep cost separate from the direct maintenance. That cost varies by port, depending on how similar a new port is to existing ones. The cost must be balanced by an overall benefit in the form of potential new users or use cases for Go. - - * At least two developers must be named (and agree) to maintain the port, by making required updates in a timely manner as architecture or operating system requirements change. - * Port maintainers are listed in the subteams of [@golang/port-maintainers](https://github.com/orgs/golang/teams/port-maintainers). To be added or removed as a maintainer for an existing port, please [file an issue](https://go.dev/issue/new). - * Changes that are specific to a particular port should normally be reviewed first by one of the port maintainers (though not the one who wrote the change, of course). We currently require two reviews for each change, so changes will still typically be reviewed by someone who is not a port maintainer, but ideally that can be a more casual review by someone less familiar with the port details. - - * A developer must be named (and agree) to maintain the builder, the machine trying each git revision and providing data for https://build.golang.org. - * Builder maintainers are listed in [`x/build/dashboard/builders.go`](https://cs.opensource.google/go/x/build/+/master:dashboard/builders.go). To update the owners for a builder, please [send a change](https://go.dev/doc/contribute) to that file. - - * The builder must already be running (and failing, because the code is not yet in the main repository). - - * All CLs necessary to run all.bash successfully must have been sent for review. Typically this will be a handful of CLs split by the part of the tree they change. - -Once those conditions are satisfied, the Go team can accept the port and begin to merge the CLs. Once the CLs are all submitted, all.bash must pass, so that the builder reports "ok" in the dashboard. - -# Other repositories - -Although it is not part of the core repository, the x/sys repository should add support for the new port before the release happens because it is the official place to add new system calls. It's OK to add support for a new port in the x/sys repository before working on the main repository. - -# First class ports - -Some ports are considered "first class". The distinction is mostly about releases. - -A first class port has these properties: - - * Broken builds block releases - * All contributors are effectively responsible for these ports (You break it, you fix it, or find someone who can.) - * Requires Google's Go team to own the builder machine - * Installation is documented at https://go.dev/doc/install - -Graduating a port to "first class" is at the discretion of the Go team at Google, -and requires an accepted proposal. - -The current first class ports are: - -* darwin/amd64 -* darwin/arm64 -* linux/386 -* linux/amd64 -* linux/arm -* linux/arm64 -* windows/386 -* windows/amd64 - -All Linux first class ports are for systems using glibc only. Linux systems using other C libraries are not fully supported and are not treated as first class. - -# Maintaining a port - -In general, people changing the Go tools and standard library must not break any of the first class ports listed above. A change that breaks a first class port must be fixed or rolled back. - -A change that breaks a secondary port will not necessarily be rolled back. If there is some reasonable possibility of breaking a secondary port developers are encouraged to make sure that the ports continue to work (for example, by running [port-specific trybots](https://go.dev/wiki/Slowbots)). Developers are also encouraged to notify secondary port maintainers of any possible port-specific problems, which they can do by reaching out to the appropriate [GitHub team(s)](https://github.com/orgs/golang/teams/port-maintainers/teams). That said, ultimately the port maintainers are responsible for keeping their ports working. - -# Broken ports - -* If a port stops working, including the case where a builder stops working, we can decide to mark the port as broken. - * Or in some cases we can roll back the change that broke it; this is a judgement call. -* In general, a port can be considered broken if its builder has failed multiple times in a development cycle with a failure mode that does not occur for first class ports, and that failure mode is not believed to have been fixed or suppressed by a change in either a Go repository or the builder's configuration, and maintainers are not actively working on a solution. -* Any approver can declare that a port that meets these criteria is broken. -* If a port is broken in release 1.N, then the core Go team can choose to remove the port from release 1.N+1. - * This is not obligatory and will depend on whether anybody is willing and able to maintain the port going forward. - -The goal here is not to get ports out of the tree; if people are actively working on the port they should have as much as latitude as possible to fix it. Removing a formerly working port should be a last resort. Finding a new maintainer is always preferable. - -# Removing old operating system and architecture versions - -To allow development effort to focus on systems that are widely available to Go users, -over time we may remove support for older operating systems and architectures, -especially older operating system versions and architecture revisions. - -The important considerations when deciding whether to remove support for an old operating system or architecture version are: - - - **Availability.** If the operating system is no longer distributed or the hardware is no longer manufactured, for example, there's not a clear need to keep it going. For example, Go's ppc64 port no longer supports the IBM POWER5 architecture. - - **Manufacturer support.** If the operating system or architecture is no longer supported by its manufacturer, that is a strong signal that a future version of Go can remove support as well. For example, each year, Apple typically issues one new version of macOS and deprecates one old version. [Go typically deprecates old macOS versions at the same rate](https://github.com/golang/go/issues/23011#issuecomment-738395341). - - **Actual or expected user base.** If there are relatively few users, significant effort to maintain a port may not be worthwhile. - - **Ongoing costs.** Ports that require significant ongoing debugging or implementation efforts will be scrutinized more than ports that don't. - -When the considerations weigh in favor of removing a port and a [proposal is accepted](https://go.dev/s/proposal-process), Go 1._N_'s release notes will announce that support for a given operating system or architecture will be dropped in Go 1.(_N_+1). - - -# Getting started - -See https://groups.google.com/forum/#!topic/golang-dev/SRUK7yJVA0c for some discussion on how to go about writing a new port. - -# Comments and Questions - -Comments or questions about the policy should be sent to golang-dev. \ No newline at end of file diff --git a/PriorDiscussion.md b/PriorDiscussion.md index d1453cd4..7d006605 100644 --- a/PriorDiscussion.md +++ b/PriorDiscussion.md @@ -1,60 +1,4 @@ -# Prior Discussion +The Go wiki on GitHub has moved to go.dev (#61940). -## Background +Try or . -This page links to prior discussion on various topics. - -The page complements the [official FAQ](https://go.dev/doc/faq). While the official FAQ contains things which are frequently asked and contains answers, this page contains things that have been repeatedly asked, but maybe not frequently, and only needs to link to one or more previous threads. Over time, these entries may graduate to entries in the official FAQ. - -**Editors:** When editing this page, please don't change the titles of sections, as that breaks the #anchors in URLs. You can rearrange, though. Feel free to add entries at will. There is no requirement for code or English review here. - -## Asked Questions & Prior Discussion - -### Panics on sends or closes of closed channel - -See https://github.com/golang/go/issues/11344#issuecomment-117862884 - -### Thread-local, Goroutine-local storage - -TODO - -### Add explicit int-to-bool conversions - -Rejected, see -https://github.com/golang/go/issues/9367#issuecomment-143128337 - -### Add mechanism to silence vet warnings - -Rejected, see discussion in https://github.com/golang/go/issues/17058 - -### Add vet warning for unused function arguments - -Rejected, see https://github.com/golang/go/issues/7892#issuecomment-66094282 - -### Make go get more verbose / add a progress bar - -Rejected, see -https://github.com/golang/go/issues/17959 -https://github.com/golang/go/issues/18388#issuecomment-268315634 - -### Shorten error handling / return sugar - -Rejected, see -https://github.com/golang/go/issues/16225 - -### Support symlinks in go toolchain / environment variables - -Rejected, see -https://github.com/golang/go/issues/15507 - -### Make unused imports/variables a warning, not an error - -Rejected. - -### Add warnings to the Go compiler - -Experience in large projects has shown that warnings pile up until people ignore all warnings, so warnings only add noise and no value (or are actively harmful in that they hide bugs). See https://go.dev/doc/faq#unused_variables_and_imports - -### Weak references - -Unlikely to be added. See discussion at https://groups.google.com/forum/#!topic/golang-nuts/PYWxjT2v6ps, and https://groups.google.com/forum/?pli=1#!topic/golang-nuts/MMWXRANh0-g which points out that `sync.Pool` is a specific form of weak reference. \ No newline at end of file diff --git a/Projects.md b/Projects.md index 09a93303..30c788b3 100644 --- a/Projects.md +++ b/Projects.md @@ -1,2042 +1,4 @@ -# Indexes and search engines +The Go wiki on GitHub has moved to go.dev (#61940). -These sites provide indexes and search engines for Go packages: +Try or . -* [pkg.go.dev](https://pkg.go.dev/) - A documentation browser for any Go open source package. -* [godocs.io](https://godocs.io/) - A simple package documentation browser (fork of gddo, the software which previously powered the now-defunct godoc.org) -* [go-hardware](https://github.com/rakyll/go-hardware) - Curated list of resources for using Go on non-standard hardware. -* [go-patterns](https://github.com/tmrts/go-patterns) - Commonly used patterns and idioms for Go. -* [Go Report Card](http://goreportcard.com/) - Code quality summaries for any Go project. -* [Sourcegraph](https://sourcegraph.com/) - Source indexing, analysis and search. -* [Codeseek.com](https://codeseek.com/) - Custom search engine with a wealth of Go blogs. - -## Dead projects - -If you find a project in this list that is dead or broken, please either mark it as such or mention it in the #go-nuts IRC channel. - -# Table of Contents -* [API Services and Tools](#api-services-and-tools) -* [Artificial Intelligence](#artificial-intelligence) -* [Astronomy](#astronomy) -* [Build Tools](#build-tools) -* [Caching](#caching) -* [Cloud Computing](#cloud-computing) -* [Command-line Option Parsers](#command-line-option-parsers) -* [Command-line Tools](#command-line-tools) -* [Compression](#compression) -* [Concurrency and Goroutines](#concurrency-and-goroutines) -* [Configuration File Parsers](#configuration-file-parsers) -* [Console User Interface](#console-user-interface) -* [Continuous Integration](#continuous-integration) -* [Cryptocurrency](#cryptocurrency) -* [Cryptography](#cryptography) -* [Databases](#databases) -* [Data Processing](#data-processing) -* [Data Structures](#data-structures) -* [Date](#date) -* [Development Tools](#development-tools) -* [Distributed/Grid Computing](#distributedgrid-computing) -* [Documentation](#documentation) -* [Editors](#editors) -* [Email](#email) -* [Encodings and Character Sets](#encodings-and-character-sets) -* [Error handling](#error-handling) -* [File Systems](#file-systems) -* [Games](#games) -* [GIS](#gis) -* [Go Implementations](#go-implementations) -* [Graphics and Audio](#graphics-and-audio) -* [GUIs and Widget Toolkits](#guis-and-widget-toolkits) -* [Hardware](#hardware) -* [Language and Linguistics](#language-and-linguistics) -* [Logging & Monitoring](#logging-and-monitoring) -* [Machine Learning & AI](#machine-learning) -* [Mathematics](#mathematics) -* [Microservices](#microservices) -* [Miscellaneous](#miscellaneous) -* [Music](#music) -* [Networking](#networking) - * [DNS](#dns) - * [FTP](#ftp) - * [HTTP](#http) - * [IMAP](#imap) - * [Instant Messaging](#instant-messaging) - * [NNTP](#nntp) - * [Protocol Buffers](#protocol-buffers) - * [rsync](#rsync) - * [Telnet](#telnet) - * [VNC](#vnc) - * [Websockets](#websockets) - * [ZeroMQ](#zeromq) - * [Misc Networking](#misc-networking) -* [Operating System Interfaces](#operating-system-interfaces) -* [Option Types](#option-types) -* [Other Random Toys, Experiments and Example Code](#other-random-toys-experiments-and-example-code) -* [P2P and File Sharing](#p2p-and-file-sharing) -* [Programming](#programming) -* [Resource Embedding](#resource-embedding) -* [RPC](#rpc) -* [Scanner and Parser Generators](#scanner-and-parser-generators) -* [Security](#security) -* [Simulation Modeling](#simulation-modeling) -* [Sorting](#sorting) -* [Source Code Management](#source-code-management) -* [Storage](#storage) -* [Strings and Text](#strings-and-text) -* [Testing](#testing) -* [Transpiler](#transpiler) -* [Unix](#unix) -* [Unsorted](#unsorted-please-help) -* [Validation](#validation) -* [Version Control](#version-control) -* [Virtual Machines and Languages](#virtual-machines-and-languages) -* [Web Applications](#web-applications) -* [Web Libraries](#web-libraries) -* [Windows](#windows) - -## API Services and Tools - -### GraphQL - * [GraphJin](https://github.com/dosco/graphjin) - Instant GraphQL API for Postgres. No code needed, compiles GraphQL to SQL. - -### MTProto - * [MTProto](https://github.com/xelaj/mtproto) - Full-native implementation of Telegram API written on pure Go. - -## Artificial Intelligence - - * [langchaingo](https://github.com/tmc/langchaingo) - LangChainGo is a framework for developing applications powered by language models. - * [go-openaih](ttps://github.com/sashabaranov/go-openai) - Go bindings for OpenAI APIs. - -## Astronomy - - * [go-fits](https://github.com/siravan/fits) - FITS (Flexible Image Transport System) format image and data reader - * [astrogo/fitsio](https://github.com/astrogo/fitsio) - Pure Go FITS (Flexible Image Transport System) format image and data reader/writer - * [cosmo](https://github.com/wmwv/cosmo) - Cosmological distance and time calculations for common cosmologies (Friedmann-Lemaître-Robertson-Walker metric). - * [gonova](https://github.com/pebbe/gonova) - A wrapper for libnova -- Celestial Mechanics, Astrometry and Astrodynamics Library - * [meeus](https://github.com/soniakeys/meeus) - Implementation of "Astronomical Algorithms" by Jean Meeus - * [novas](https://github.com/pebbe/novas) - Interface to the Naval Observatory Vector Astrometry Software (NOVAS) - * [utdfgo](https://github.com/attron/utdfgo) - Spacecraft UTDF Packet Reader and Decoder - -## Build Tools - - * [beku](https://github.com/shuLhan/beku) - A library and program to manage packages in user's environment (GOPATH or vendor directory) - * [colorgo](https://github.com/songgao/colorgo) - Colorize go build output - * [dogo](https://github.com/liudng/dogo) - Monitoring changes in the source file and automatically compile and run (restart) - * [fileembed-go](https://bitbucket.org/rj/fileembed-go/) - This is a command-line utility to take a number of source files, and embed them into a Go package - * [gb](http://github.com/skelterjohn/go-gb) - A(nother) build tool for go, with an emphasis on multi-package projects - * [gg](https://github.com/lukess/gg) - A tiny multi golang projects env/make management tool. - * [GG](http://www.manatlan.com/page/gg) - A build tool for Go in Go - * [godag](http://code.google.com/p/godag/) - A frontend to the Go compiler collection - * [goenv](https://bitbucket.org/ymotongpoo/goenv) - goenv provides Go version and Go workspace management tools - * [gopei](https://github.com/geosoft1/tools) - Simple Go compiler and LiteIDE installer for Unix/Linux that adds many features like github support and presenter. - * [go-pkg-config](https://github.com/psilva261/go-pkg-config) - lightweight clone of pkg-config - * [goscons](https://github.com/alberts/goscons) - Another set of SCons builders for Go - * [go-server](https://github.com/cheikhshift/Gopher-Sauce) - Agile server framework. - * [gotgo](https://github.com/droundy/gotgo) - An experimental preprocessor to implement 'generics' - * [gows](https://github.com/ascarter/gows) - Go workspace manager - * [goxc](https://github.com/laher/goxc) - A build tool with a focus on cross-compiling, packaging, versioning and distribution - * [GVM](https://github.com/moovweb/gvm) - GVM provides an interface to manage Go versions - * [Realize](https://github.com/tockins/realize) - A Go build system with file watchers, output streams and live reload. Run, build and watch file changes with custom paths. - * [SCons Go Tools](https://launchpad.net/sconsgo) - A collection of builders that makes it easy to compile Go projects in SCons - * [Task](https://github.com/go-task/task) - A task runner / simple alternative to Make - -## Caching - - * [cache2go](https://github.com/muesli/cache2go) - Concurrency-safe caching library with expiration capabilities and access counters - * [cache](https://github.com/chai2010/cache) - LevelDB style LRU cache for Go, support non GC object cache. - * [go-cache](http://patrickmylund.com/projects/go-cache/) - An in-memory key:value store/cache (similar to Memcached) library for Go, suitable for single-machine applications - * [golibs/cache](https://github.com/SimonWaldherr/golibs/tree/master/cache) - A tiny cache package - * [gomemcached](https://github.com/dustin/gomemcached) - A memcached server in go - * [gomemcache](https://github.com/kklis/gomemcache) - a memcached client - * [go-slab](https://github.com/couchbaselabs/go-slab) - Slab allocator for go. - * [groupcache](https://github.com/golang/groupcache) - Caching and cache-filling library, intended as a replacement for memcached in many cases - * [libmemcache](https://github.com/valyala/ybc/tree/master/libs/go/memcache) - Fast client and server libraries speaking memcache protocol - * [memcached-bench](https://github.com/valyala/ybc/tree/master/apps/go/memcached-bench) - Benchmark tool for memcache servers - * [memcached](https://github.com/valyala/ybc/tree/master/apps/go/memcached) - Fast memcache server, which supports persistence and cache sizes exceeding available RAM - * [memcache](https://github.com/smallfish/memcache) - go memcached client, forked from YouTube Vitess - * [rend](https://github.com/Netflix/rend) - A memcached proxy that manages data chunking and L1/L2 caches - * [YBC bindings](https://github.com/valyala/ybc/tree/master/bindings/go/ybc) - Bindings for YBC library providing API for fast in-process blob cache - * [g2cache](https://github.com/kelvins-io/g2cache) -A coordinated local and external two-level caching scheme -## Cloud Computing - - * [aws-sdk-go](https://github.com/aws/aws-sdk-go) - AWS SDK for the Go programming language. - * [Docker](http://docker.io) - The Linux container runtime. Developed by dotCloud. - * [Enduro/X ASG](https://github.com/endurox-dev/endurox-go) Application Server for Go. Provides application server and middleware facilities for distributed transaction processing. Supports microservices based application architecture. Developed by ATR Baltic. - * [flamingo](https://github.com/tmrts/flamingo) - A Lightweight Cloud Instance Contextualizer. - * [gocircuit](http://gocircuit.org) - A distributed operating system that sits on top of the traditional OS on multiple machines in a datacenter deployment. It provides a clean and uniform abstraction for treating an entire hardware cluster as a single, monolithic compute resource. Developed by Tumblr. - * [gosync](https://github.com/brettweavnet/gosync) - A package for syncing data to and from S3. - * [juju](https://juju.ubuntu.com) - Orchestration tool (deployment, configuration and lifecycle management), developed by Canonical. - * [Kubernetes](https://github.com/kubernetes/kubernetes) - Container Cluster Manager from Google. - * [LXD](https://github.com/lxc/lxd) Daemon based on liblxc offering a REST API to manage containers - * [mgmt](https://github.com/purpleidea/mgmt/) - Next Generation Configuration Management tool (parallel, event driven, distributed system) developed by [@purpleidea](https://twitter.com/#!/purpleidea), (a Red Hat employee) and the mgmt community. - * [rclone](http://rclone.org/) - "rsync for cloud storage" - Google Drive, Amazon Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Cloudfiles, Google Cloud Storage, Yandex Files - * [ShipBuilder](http://shipbuilder.io) - ShipBuilder is a minimalist open source platform as a service, developed by Jay Taylor. - * [swift](https://github.com/ncw/swift) - Go language interface to Swift / Openstack Object Storage / Rackspace cloud files - * [Tsuru](http://www.tsuru.io/) - Tsuru is an open source polyglot cloud computing platform as a service (PaaS), developed by Globo.com. - -## Command-line Option Parsers - - * [argcfg](http://code.google.com/p/goargcfg/) - Use reflection to populate fields in a struct from command line arguments - * [autoflags](https://github.com/artyom/autoflags) - Populate go command line app flags from config struct - * [carapace](https://github.com/rsteube/carapace) - Command argument completion generator for spf13/cobra. - * [cobra](http://github.com/spf13/cobra) - A commander for modern go CLI interactions supporting commands & POSIX/GNU flags - * [cli](https://github.com/mitchellh/cli) - A Go library for implementing command-line interfaces. - * [cmdline](https://github.com/galdor/go-cmdline) - A simple parser with support for short and long options, default values, arguments and subcommands. - * [command](https://github.com/rakyll/command) - Add subcommands to your CLI, provides help and usage guide. - * [docopt.go](https://github.com/docopt/docopt.go) - An implementation of docopt in the Go programming language. - * [flaq](https://github.com/qdamm/flaq) - Command-line options parsing library, POSIX/GNU compliant, supports struct tags as well as the Go's flag approach. - * [getopt](http://code.google.com/p/getopt) - full featured traditional (BSD/POSIX getopt) option parsing in Go style - * [getopt](https://github.com/timtadh/getopt) - Yet Another getopt Library for Go. This one is like Python's. - * [gnuflag](https://launchpad.net/gnuflag) - GNU-compatible flag parsing; substantially compatible with flag. - * [go-commander](https://code.google.com/p/go-commander) - Simplify the creation of command line interfaces for Go, with commands and sub-commands, with argument checks and contextual usage help. Forked from the "go" tool code. - * [go-flags](https://github.com/jessevdk/go-flags) - command line option parser for go - * [go-getoptions](https://github.com/DavidGamba/go-getoptions) - Go option parser inspired on the flexibility of Perl s GetOpt::Long. - * [goopt](https://github.com/droundy/goopt) - a getopt clone to parse command-line flags - * [go-options](https://github.com/gaal/go-options) - A command line parsing library for Go - * [`mellium.im/cli`](https://pkg.go.dev/mellium.im/cli) A library for parsing modern CLI apps including subcommands that may have their own flags and a built in help system. Designed to use a minimal API. - * [options](https://github.com/fd/options/) - Self documenting CLI options parser - * [opts.go](http://opts-go.googlecode.com/) - lightweight POSIX- and GNU- style option parsing - * [pflag](https://github.com/ogier/pflag) - Drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags. - * [subcommands](https://github.com/maruel/subcommands) - A concurrent, unit tested, subcommand library - * [uggo](https://github.com/laher/uggo) - Yet another option parser offering gnu-like option parsing. This one wraps (embeds) flagset. It also offers rudimentary pipe-detection (commands like ls behave differently when being piped to). - * [xflags](https://github.com/cavaliergopher/xflags) - Expressive flags for Go - * [writ](https://github.com/ziuchkovski/writ) - A flexible option parser with thorough test coverage. It's meant to "just work" and stay out of the way. - -## Command-line Tools - - * [amqp-message-remover](https://github.com/nazar256/amqp-message-remover) - Removes unwanted messages by regexp pattern from AMQP queue - * [Arduino-cli](https://github.com/arduino/arduino-cli) - Arduino CLI is an all-in-one solution that provides builder, boards/library manager, uploader, discovery and many other tools needed to use any Arduino compatible board and platforms. - * [awless](https://github.com/wallix/awless) - A Mighty command-line interface for Amazon Web Services (AWS). - * [boilr](https://github.com/tmrts/boilr) - A blazing fast CLI tool for creating projects from boilerplate templates. - * [carapace-bin](https://github.com/rsteube/carapace-bin) - Multi-shell multi-command argument completer. - * [carapace-spec](https://github.com/rsteube/carapace-spec) - Define simple completions using a spec file. - * [comb-go](https://github.com/bingohuang/comb-go) - A CLI tool implemented by Golang to manage [CloudComb](http://c.163.com) resources. - * [coshell](https://github.com/gdm85/coshell) - A drop-in replacement for GNU 'parallel'. - * [dasel](https://github.com/tomwright/dasel) - Query and update data structures using selectors from the command line. Comparable to [jq](https://github.com/stedlan/jq) / [yq](https://github.com/kislyuk/yq) but supports JSON, YAML, TOML and XML with zero runtime dependencies. - * [DevTodo2](https://github.com/alecthomas/devtodo2) - A small command-line per-project task list manager. - * [dsio](https://github.com/nshmura/dsio) - Command line tool for Google Cloud Datastore. - * [efs2](https://github.com/madflojo/efs2) - A dead-simple configuration management tool that is powered by stupid shell scripts. - * [enumeration](https://bitbucket.org/rickb777/enumeration) - Easy enumeration code generation. - * [fzf](https://github.com/junegunn/fzf) - A command-line fuzzy finder - * [gich](http://bitbucket.org/jpoirier/gich) - A cross platform which utility written in Go - * [gister](https://github.com/dutchcoders/gister) - Manage your github gists from the command-line - * [git-time-metric](https://github.com/git-time-metric/gtm) - Simple, seamless, lightweight time tracking for Git - * [gmail2go](https://github.com/rif/gmail2go) - Simple gmail multiple accounts cli mail checker - * [go-amqp-sniffer](https://github.com/nazar256/go-amqp-sniffer) - Listens from AMQP exchange and streams messages to standard output in mongoimport compatible JSON - * [gocreate](https://bitbucket.org/llg/gocreate/) - Command line utility that create files from templates. - * [godocdoc](https://github.com/kevinburke/godocdoc) - Start godoc and open it in your browser to the project in the current directory. - * [gojson](https://github.com/ChimeraCoder/gojson) - Command-line tool for manipulating JSON for use in developing Go code. - * [golor](https://github.com/hantuo/golor) - golor is a command line tool for golang source code coloring - * [GoNote](https://github.com/exaroth/gonote) - Command line SimpleNote client. - * [gopass](https://github.com/justwatchcom/gopass) - Command line password manager with git syncing capabilities - * [GoPasswordCreator](https://github.com/d3xter/GoPasswordCreator) - A small tool, which creates random passwords - * [Grozilla](https://github.com/prashant-agarwala/grozilla) - File downloader utility with resume capability. - * [JayDiff](https://github.com/yazgazan/jaydiff) - A JSON diff utility written in Go. - * [jsonpp](http://jmhodges.github.com/jsonpp/) - A fast command line JSON pretty printer. - * [lsp](https://github.com/dborzov/lsp) - A human-friendlier alternative to `ls` - * [ltst](https://github.com/marcelpuyat/ltst) - View the latest news of your choosing right in your terminal - * [passhash](https://github.com/gebi/passhash) - Command-line utility to create secure password hashes - * [passman](https://github.com/seanpont/passman) - A command-line password manager - * [pdfcpu](https://github.com/hhrutter/pdfcpu) - PDF processor. - * [pjs](http://jcasts.github.io/pjs) - Pretty print and search through JSON data structures fast. - * [project](https://github.com/nildev/project) - Very simple CLI tool to setup new projects from boilerplate templates. - * [redis-view](https://github.com/dreamersdw/redis-view) - A tree like tool help you explore data structures in your redis server - * [remote-torrent](https://github.com/brucewangno1/remote-torrent) - A simple tool for downloading Torrent remotely and retrieving files back over HTTP at full speed without ISP Torrent limitation - * [restic](https://github.com/restic/restic) - A fast, efficient and secure backup program - * [runtemplate](https://github.com/flowonyx/runtemplate) - A very simple command-line tool for executing Go templates, useful for use with `go generate`. - * [runtemplate](https://github.com/rickb777/runtemplate) - A simple tool for executing Go templates to support generating Go code for your types. - * [sift](https://github.com/svent/sift) - A fast and powerful open source alternative to `grep` - * [tecla](https://github.com/michaelmacinnis/tecla) - Command-line editing library - * [Terracognita](https://github.com/cycloidio/terracognita) - Reads from existing Cloud Providers (reverse Terraform) and generates your infrastructure as code on Terraform configuration. - * [wlog](https://github.com/dixonwille/wlog) - A simple logging interface that supports cross-platform color and concurrency. - * [wmenu](https://github.com/dixonwille/wmenu) - An easy to use menu structure for cli applications that prompts users to make choices. - * [mani](https://github.com/alajmo/mani) - CLI tool to help you manage multiple repositories -## Compression - - * [brotli](https://github.com/google/brotli/tree/master/go/cbrotli) - go bindings for Brotli algorithm. - * [compress](https://github.com/klauspost/compress) - Faster drop in replacements for gzip, zip, zlib, deflate. - * [dgolzo](https://github.com/dgryski/dgolzo) - LZO bindings. - * [go-lzo](https://github.com/rasky/go-lzo) - Pure-Go LZO compressor/decompression, faithful translation of the C codebase. - * [dictzip](https://github.com/pebbe/dictzip) - A reader and writer for files in the random access ` dictzip ` format. - * [fast-archiver](https://github.com/replicon/fast-archiver) - Alternative archiving tool with fast performance for huge numbers of small files. - * [gbacomp](https://github.com/salviati/gbacomp) - A Go library to (de)compress data compatible with GBA BIOS. - * [go-lz4](https://github.com/bkaradzic/go-lz4) - Port of LZ4 lossless compression algorithm to Go. - * [go-lzss](https://github.com/salviati/go-lzss) - Implementation of LZSS compression algorithm in Go. - * [go-sevenzip](https://github.com/salviati/go-sevenzip) - Package sevenzip implements access to 7-zip archives (wraps C interface of LZMA SDK). - * [go-zip](https://github.com/hailiang/go-zip) - A wrapper around C library libzip, providing ability to modify existing ZIP archives. - * [lz4](https://github.com/pierrec/lz4) - High performance, concurrent LZ4 implementation. - * [lzma](http://code.google.com/p/lzma/) - compress/lzma package for Go. - * [pgzip](https://github.com/klauspost/pgzip) - Multicore gzip, compatible with the standard library. - * [ppmd-go](https://github.com/zwb-ict/ppmd-go) - Golang bindings for the LZMA SDK library. (Only binded PPMD) - * [s2](https://github.com/klauspost/compress/tree/master/s2) - High throughput Snappy extension. - * [snappy-go](http://code.google.com/p/snappy-go/) - Google's Snappy compression algorithm in Go. - * [yenc](https://github.com/chrisfarms/yenc) - yenc decoder package. - * [zappy](https://github.com/cznic/zappy) - Package zappy implements the zappy block-based compression format. It aims for a combination of good speed and reasonable compression. - * [zstd](https://github.com/klauspost/compress/tree/master/zstd) - Pure Go Zstandard compression/decompression. - - -## Concurrency and Goroutines - - * [grpool](https://github.com/ivpusic/grpool) - Lightweight Goroutine pool. - * [pool](https://github.com/go-playground/pool) - Go consumer goroutine pool for easy goroutine handling + time saving. - * [tunny](https://github.com/Jeffail/tunny) - A goroutine pool. - * [worker](https://github.com/duzy/worker) - An easy and lightweight concurrent job framework. - -## Configuration File Parsers - - * [awsenv](https://github.com/soniah/awsenv) - a small binary that loads Amazon (AWS) environment variables for a profile - * [`code.soquee.net/env`](https://code.soquee.net/env/) — Load environment variables from `.env` or similar files, or from any `io.Reader` and populate the local environment. - * [confl](https://github.com/lytics/confl) - nginx config syntax, lenient, encode/decode, custom marshaling - * [configor](https://github.com/jinzhu/configor) - Golang Configuration tool that support YAML, JSON, TOML, Shell Environment - * [fig](https://github.com/kkyr/fig) - Tiny library for reading configuration from a file and from environment variables (with validation & defaults). - * [flagfile](https://github.com/spacemonkeygo/flagfile) - Adds parsing and serialization support to the standard library flag package (adds a --flagfile option) - * [gcfg](http://code.google.com/p/gcfg/) - read INI-style configuration files into Go structs; supports user-defined types and subsections - * [globalconf](https://github.com/rakyll/globalconf) - Effortlessly persist to and read flag values from an ini config file - * [goconf](http://code.google.com/p/goconf/) - a configuration file parser - * [goconfig](https://github.com/fulldump/goconfig) - Configuration based on struct introspection, supports environment vars, command line args, and more. - * [hjson](https://github.com/laktak/hjson-go) - Human JSON, a configuration file format for humans. Relaxed syntax, fewer mistakes, more comments. - * [hocon](https://github.com/gurkankaymak/hocon) - Configuration library for working with the HOCON(a human-friendly JSON superset) format, supports features like environment variables, referencing other values, comments and multiple files. - * [jsonconfig](https://github.com/knadh/jsonconfig) - a JSON configuration file parser with comments support - * [koanf](https://github.com/knadh/koanf) - Light weight, extensible library for reading config in Go applications. Built in support for JSON, TOML, YAML, env, command line. - * [lib/ini](https://pkg.go.dev/github.com/shuLhan/share/lib/ini) - Package ini implement reading and writing INI text format as defined by Git configuration file syntax. - * [lib/ssh/config](https://pkg.go.dev/github.com/shuLhan/share/lib/ssh/config) - Package config provide the ssh_config(5) parser and getter. - * [nestext](https://github.com/npillmayer/nestext) - Package nestext provides tools for processing NestedText, a human friendly data format. - * [properties](https://github.com/magiconair/properties) - Library for reading and writing properties files - * [scribeconf](https://pkg.go.dev/github.com/fumin/scribeconf) - Facebook Scribe server configuration file parser - * [toml](http://github.com/mojombo/toml): - * [go-toml-config](http://github.com/stvp/go-toml-config) - TOML-based config for Go - * [go-toml](http://github.com/pelletier/go-toml) - Go library for the TOML language - * [gp-config](https://github.com/cbonello/gp-config) - Subset of TOML syntax with basic and reflection APIs - * [toml-go](http://github.com/laurent22/toml-go) - An easy-to-use Go parser for the Toml format - * [toml](http://github.com/BurntSushi/toml) - TOML parser for Go with reflection - * [tom-toml](https://github.com/achun/tom-toml) - TOML parser for Go, support comments/formatter/apply. - * [uConfig](https://github.com/omeid/uconfig) - an unopinionated, extendable and plugable configuration management. Supports YAML, TOML, JSON, Env vars, K8s DAPI, et al. - * [viper](http://github.com/spf13/viper) - a complete configuration solution supporting YAML, TOML & JSON and integration with command line flags - * yaml: - * [yaml](http://github.com/go-yaml/yaml) - YAML support for the Go language, by Canonical - * [goyaml](http://goyaml.googlecode.com/) - A port of LibYAML to Go - * [go-yaml](https://github.com/goccy/go-yaml) - YAML support for the Go language - -## Console User Interface - - * [ansi](https://github.com/mgutz/ansi) - Easily create ansi escape code strings and closures to format, color console output - * [ansiterm](https://github.com/hotei/ansiterm) - pkg to drive text-only consoles that respond to ANSI escape sequences - * [box-cli-maker](https://github.com/Delta456/box-cli-maker) - Make Highly Customized Boxs for your CLI. - * [bubbletea](https://github.com/charmbracelet/bubbletea) - A powerful little TUI framework - * [cons](https://github.com/rferrante/cons) - A simple package for building interactive console tools. - * [gnureadline](https://code.google.com/p/go-gnureadline) - GNU Readline bindings - * [go-ansiout](https://github.com/tlorens/go-ansiout) - Another ANSI escape code sequence tool for use with command-line applications. - * [gockel](https://github.com/akrennmair/gockel) - a Twitter client for text terminals - * [gocui](https://github.com/jroimartin/gocui) - Minimalist library aimed at creating Console User Interfaces - * [gocurse](https://github.com/jabb/gocurse) - Go bindings for NCurses - * [gocurses](https://github.com/tncardoso/gocurses) - NCurses wrapper - * [go-ibgetkey](https://github.com/tlorens/go-ibgetkey) - "hot key" type user input package for use in processing keystrokes in command-line applications. - * [go.linenoise](https://github.com/GeertJohan/go.linenoise) - Linenoise bindings (simple and easy readline with prompt, optional history, optional tab completion) - * [goncurses](https://github.com/rthornton128/goncurses) - An ncurses library, including the form, menu and panel extensions - * [gopass](https://code.google.com/p/gopass/) - Allows typing of passwords without echoing to screen - * [go-pullbarz](https://github.com/tlorens/go-pullbarz) - Fancy "light bar" menus like in Lotus 123 from the DOS days. Dependent on go-ibgetkey and go-ansiout. - * [go.sgr](https://github.com/foize/go.sgr) - Terminal/console colors and text decoration (bold,underlined,etc). - * [go-stfl](https://github.com/akrennmair/go-stfl) - a thin wrapper around STFL, an ncurses-based widget toolkit - * [goterminal](https://github.com/apoorvam/goterminal) - A go library that lets you write and then re-write the text on terminal, to update progress. It works on Windows too! - * [go-web-shell](https://github.com/matiasinsaurralde/go-web-shell) - Remote web shell, implements a net/http server. - * [igo](https://bitbucket.org/binet/igo) - A simple interactive Go interpreter built on exp/eval with some readline refinements - * [oh](https://github.com/michaelmacinnis/oh) - A Unix shell written in Go - * [pty](https://github.com/kr/pty) - obtain pseudo-terminal devices - * [readline](https://github.com/chzyer/readline) - A pure go implementation for GNU-Readline kind library - * [tcell](https://github.com/gdamore/tcell) - Tcell is an alternate terminal package, similar in some ways to termbox, but better in others. - * [termbox-go](https://github.com/nsf/termbox-go) - A minimalist alternative to ncurses to build terminal-based user interfaces - * [termios](http://bitbucket.org/taruti/termios) - Terminal support - * [termon](http://termon.googlecode.com/) - Easy terminal-control-interface for Go. - * [uilive](https://github.com/gosuri/uilive) - uilive is a go library for updating terminal output in realtime. - * [uiprogress](https://github.com/gosuri/uiprogress) - A library to render progress bars in terminal applications. - * [uitable](https://github.com/gosuri/uitable) - A library to improve readability in terminal apps using tabular data. - * [yandex-weather-cli](https://github.com/msoap/yandex-weather-cli) - Command line interface for Yandex weather service - -## Continuous Integration - - * [goveralls](https://github.com/mattn/goveralls) - Go integration for Coveralls.io continuous code coverage tracking system. - * [overalls](https://github.com/go-playground/overalls) - Multi-Package go project coverprofile for tools like goveralls - -## Cryptocurrency - * [Skycoin](https://github.com/skycoin/skycoin) - Skycoin is a next-generation cryptocurrency written in Go. Skycoin is not designed to add features to Bitcoin, but rather improves Bitcoin by increasing simplicity, security and stripping out everything non-essential. - -## Cryptography - - * [BLAKE2b](https://github.com/dchest/blake2b) - Go implementation of BLAKE2b hash function - * [cryptogo](https://github.com/vgorin/cryptogo) - some useful cryptography-related functions, including paddings (PKCS7, X.923), PBE with random salt and IV - * [cryptoPadding](https://github.com/apexskier/cryptoPadding) - Block padding schemes implemented in Go - * [dkeyczar](https://github.com/dgryski/dkeyczar) - Go port of Google'e Keyczar cryptography library - * [dkrcrypt](https://github.com/dgryski/dkrcrypt) - Korean block ciphers: SEED and HIGHT - * [dskipjack](https://github.com/dgryski/dskipjack) - Go implementation of the SKIPJACK encryption algorithm - * [go-cs](https://github.com/akosela/go-cs) - concurrent ssh client. - * [go-ed25519](https://github.com/tendermint/go-ed25519) - CGO bindings for Floodberry's ed25519-donna. Fast batch verification. - * [go-hc128](https://github.com/tomfitzhenry/go-hc128) - Go implementation of HC-128, an eSTREAM stream cipher - * [go-jose](https://github.com/square/go-jose) - Go implementation of the JOSE standards - * [go-lioness](https://github.com/applied-mixnetworks/go-lioness) - Lioness wide-block cipher using Chacha20 and Blake2b - * [go-minilock](https://github.com/cathalgarvey/go-minilock) - Go implementation of the minilock file encryption system. - * [GoSkein](https://github.com/wernerd/Skein3Fish/tree/master/go) - Implementation of Skein hash and Threefisch crypto for Go - * [go-sphinxmixcrypto](https://github.com/applied-mixnetworks/go-sphinxmixcrypto) - Sphinx mix network cryptographic packet format operations - * [keccak](https://github.com/ebfe/keccak) - A keccak (SHA-3) implementation - * [ketama.go](https://github.com/mncaudill/ketama.go) - libketama-style consistent hashing - * [kindi](https://github.com/uwedeportivo/Kindi) - encryption command line tool - * [openssl](https://github.com/spacemonkeygo/openssl) - openssl bindings for go - * [otrcat](https://github.com/andrewclausen/otrcat) - a general purpose command-line tool for communicating using the Off-The-Record protocol - * [scrypt](https://go.googlesource.com/crypto/+/master/scrypt/) - Go implementation of Colin Percival's scrypt key derivation function - * [secureio](https://github.com/xaionaro-go/secureio) - An easy-to-use XChaCha20-encryption wrapper for `io.ReadWriteCloser` using ECDH key exchange algorithm, ED25519 signatures and Blake3+Poly1305 checksums/message-authentication. Also a multiplexer. - * [simpleaes](https://github.com/tadzik/simpleaes) - AES encryption made easy - * [siphash](https://github.com/dchest/siphash) - SipHash: a fast short-input pseudorandom function - * [SRP](https://code.google.com/p/go-srp/) - SRP: Secure Remote Password - Implementation in go - * [ssh-vault](https://github.com/ssh-vault/ssh-vault) - encrypt/decrypt using ssh keys - * [themis](https://github.com/cossacklabs/themis) - Multi-platform high-level cryptographic library for protecting sensitive data: secure messaging with forward secrecy, secure data storage (AES256GCM); suits for building end-to-end encrypted applications - * [tiger](https://github.com/cxmcc/tiger) - Tiger cryptographic hashing algorithm - * [whirlpool](https://github.com/jzelinskie/whirlpool) - whirlpool cryptographic hashing algorithm - -## Data Processing - - * [automi](https://github.com/vladimirvivien/automi) - Compose process and integration flows on Go channels - * [Gleam](https://github.com/chrislusf/gleam) - Fast, efficient, and scalable distributed map/reduce system, DAG execution, in memory or on disk, runs standalone or distributedly. - * [Glow](https://github.com/chrislusf/glow) - Glow is an easy-to-use distributed computation system, similar to Hadoop Map Reduce, Spark, Flink, Storm. - * [gostatsd](https://github.com/kisielk/gostatsd) - Statsd server and library. - * [Heka](https://github.com/mozilla-services/heka) - Real time data and log file processing engine. - * [Kapacitor](https://github.com/influxdb/kapacitor) - Framework for processing, monitoring and alerting on timeseries data. - * [parapipe](https://github.com/nazar256/parapipe) - FIFO Pipeline which parallels execution on each stage while maintaining the order of messages and results - * [pipe](https://github.com/lennon-guan/pipe) - Several functional programming supporting in golang (Map/Reduce/Filter) - * [proto](https://github.com/eblume/proto) - Map/Reduce/Filter etc. for Go using channels as result streams. - * [ratchet](https://github.com/dailyburn/ratchet) - A library for performing data pipeline / ETL tasks in Go. - * [regommend](https://github.com/muesli/regommend) - Recommendation engine. - * [rrd](https://github.com/ziutek/rrd) - Bindings for rrdtool. - * [XConv](https://github.com/howcrazy/xconv) - Convert any value between types (base type, struct, array, slice, map, etc.) - -## Data Structures - -### Collections - - * [collections](https://github.com/cosn/collections) - Several common data structures - * [data-structures](https://github.com/timtadh/data-structures) - A collection of data-structures (ArrayList, SortedList, Set, AVL Tree, Immutable AVL Tree, B+Tree, Ternary Search Trie, Hash Table (Separate Chaining), Linear Hash Table) - * [ps](https://github.com/mndrix/ps) - Persistent data structures - * [Tideland golib](https://github.com/tideland/golib) - A collections library - * [GoDS](https://github.com/emirpasic/gods) - Sets, Lists, Stacks, Maps, Trees, Queues, and much more - -### Hashtables - - * [bimap](https://github.com/diogobeda/bimap) - A simple bidirectional map implementation - * [gohash](http://code.google.com/p/gohash/) - A simple linked-list hashtable that implements sets and maps - * [go-maps](https://github.com/serge-hulne/go-maps) - Go maps generalized to interfaces - -### Lists - - * [fs2/mmlist](https://github.com/timtadh/fs2#mmlist) - A memory mapped list. - * [GoArrayList](https://github.com/PhilStephens/GoArrayList) - GoArrayList is a Go language substitute for the Java class ArrayList, with very nearly all features. - * [goskiplist](https://github.com/ryszard/goskiplist) - A skip list implementation in Go. - * [itreap](https://github.com/glenn-brown/itreap) - An immutable ordered list, internally a treap. - * [ListDict](https://bitbucket.org/matrixik/listdict/) - Python List and Dict for Go - * [skip](https://github.com/glenn-brown/skiplist) - A fast position-addressable ordered map and multimap. - * [Skiplist](https://github.com/glenn-brown/skiplist) - A fast indexable ordered multimap. - * [skiplist](https://github.com/huandu/skiplist) - A skip list implementation. Highly customizable and easy to use. - * [skiplist](https://pkg.go.dev/github.com/fumin/skiplist) - Skiplist data structure ported from Redis's Sorted Sets. - * [stackgo](https://github.com/alediaferia/stackgo) - A fast slice-based stack implementation. - -### Queues - - * [fifo\_queue](https://github.com/yasushi-saito/fifo_queue) - Simple FIFO queue - * [figo](https://github.com/jasocox/figo) - A simple fifo queue with an optional thread-safe version. - * [go.fifo](https://github.com/foize/go.fifo) - Simple auto-resizing thread-safe fifo queue. - * [gopqueue](https://github.com/nu7hatch/gopqueue) - Priority queue at top of container/heap - * [go-priority-queue](https://code.google.com/p/go-priority-queue/) - An easy to use heap implementation with a conventional priority queue interface. - * [golibs/stack](https://github.com/SimonWaldherr/golibs/tree/master/stack) - A LIFO and ringbuffer package - * [gringo](https://github.com/textnode/gringo) - A minimalist queue implemented using a stripped-down lock-free ringbuffer - * [heap](https://github.com/golangplus/container/tree/master/heap) - A general heap package without converting elements to `interface{}` and back. - * [queued](https://github.com/timtadh/queued) - A simple network queue daemon - * [queue](https://github.com/kavehmz/queue) - A queue manager on top of Redis - -### Graphs - - * [graph](https://github.com/yourbasic/graph) - Library of basic graph algorithms - * [graphs](https://github.com/thcyron/graphs) - Implementation of various tree, graph and network algorithms - * [groph](https://codeberg.org/fractalqb/groph) - A pure Go library of graphs and algorithms - -### Sets - - * [disjoint](https://github.com/spakin/disjoint) - Disjoint sets (union-find algorithm with path compression) - * [golang-set](https://github.com/deckarep/golang-set) - A full thread-safe and unsafe set implementation for Go. - * [goset](https://github.com/fatih/goset) - A simple, thread safe Set implementation - * [set](https://github.com/fatih/set) - Set data structure for Go - -### Trees - - * [b](https://github.com/cznic/b) - Package b implements B+trees with delayed page split/concat and O(1) enumeration. Easy production of source code for B+trees specialized for user defined key and value types is supported by a simple text replace. - * [btree](https://bitbucket.org/santucco/btree) - Package btree implements persistent B-trees with fixed size keys, http://en.wikipedia.org/wiki/Btree - * [btree](https://github.com/google/btree) - In-memory (not persistent) B-tree implementation, similar API to GoLLRB - * [go-avltree](https://github.com/ancientlore/go-avltree) - AVL tree (Adel'son-Vel'skii & Landis) with indexing added - * [go-btree](https://github.com/liangx8/tree.git) - Simple balance tree implementation - * [go-darts](https://github.com/awsong/go-darts) - Double-ARray Trie System for Go - * [GoLLRB](https://github.com/petar/GoLLRB) - A Left-Leaning Red-Black (LLRB) implementation of 2-3 balanced binary search trees in Google Go - * [go-merkle](https://github.com/tendermint/go-merkle) - Merkle-ized binary (search) trees with proofs. - * [go-radix](https://github.com/armon/go-radix), [go-radix-immutable](https://github.com/hashicorp/go-immutable-radix) - Radix tree implementations. - * [go-stree](https://github.com/toberndo/go-stree) - A segment tree implementation for range queries on intervals - * [gtreap](https://github.com/steveyen/gtreap) - Persistent treap implementation. - * [prefixmap](https://github.com/alediaferia/prefixmap) - Simple trie-based prefix-map for string-based keys - * [rbtree](https://github.com/cdongyang/library/tree/master/rbtree) - A high performance red-black tree with an API similar to C++ STL's for set, map, multiset, multimap. - * [rbtree](https://github.com/yasushi-saito/rbtree) - Yet another red-black tree implementation, with a C++ STL-like API - * [rtreego](https://github.com/dhconnelly/rtreego) - an R-Tree library - * [triego](https://github.com/alediaferia/triego) - Simple trie implementation for storing words - -### Other - - * [aurora](https://github.com/xuri/aurora) - Cross-platform Beanstalk queue server console. - * [bigendian](https://bitbucket.org/taruti/bigendian) - binary parsing and printing - * [deepcopy](http://bitbucket.org/taruti/deepcopy) - Make deep copies of data structures - * [dgobloom](https://github.com/dgryski/dgobloom) - A Bloom Filter implementation - * [epochdate](https://github.com/extemporalgenome/epochdate) - Compact dates stored as days since the Unix epoch - * [etree](https://github.com/beevik/etree) - Parse and generate XML easily - * [excelize](https://github.com/xuri/excelize) - Go library for reading and writing Microsoft Excel (XLSX) files. - * [fsm](https://github.com/looplab/fsm) - Minimalistic state machine for use instead of booleans - * [go-algs/ed](https://github.com/daviddengcn/go-algs) - Generalized edit-distance implementation - * [go-algs/maxflow](https://github.com/daviddengcn/go-algs) - An energy minimization tool using max-flow algorithm. - * [gocrud](https://github.com/manishrjain/gocrud) - Framework for working with arbitrary depth data structures. - * [go-extractor](https://github.com/salviati/go-extractor) - Go wrapper for GNU libextractor - * [Gokogiri](https://github.com/moovweb/gokogiri) - A lightweight libxml wrapper library - * [GoNetCDF](https://bitbucket.org/ctessum/gonetcdf) - A wrapper for the NetCDF file format library - * [goop](https://github.com/lanl/goop) - Dynamic object-oriented programming support for Go - * [gopart](https://github.com/meirf/gopart)- Type-agnostic partitioning for anything that can be indexed in Go. - * [gotoc](https://github.com/dsymonds/gotoc) - A protocol buffer compiler written in Go - * [govalid](https://github.com/gima/govalid) - Data validation library - * [goxlsxwriter](https://github.com/fterrag/goxlsxwriter) - Golang bindings for libxlsxwriter for writing XLSX (Excel) files - * [goxml](https://github.com/jbussdieker/golibxml) - A thin wrapper around libxml2 - * [hyperloglog](https://github.com/clarkduvall/hyperloglog) - An implementation of the HyperLogLog and HyperLogLog++ algorithms for estimating cardinality of sets using constant memory. - * [itertools](https://github.com/xchapter7x/goutil) - Provides generic iterable generator function along with functionality similar to the itertools python package. - * [jsonv](https://github.com/gima/jsonv) - A JSON validator - * [libgob](http://code.google.com/p/libgob/) - A low level library for generating gobs from other languages - * [mxj](https://github.com/clbanning/mxj) - Marshal/Unmarshal XML doc from/to `map[string]interface{}` or JSON - * [ofxgo](https://github.com/aclindsa/ofxgo) - A library for querying OFX servers and/or parsing the responses (and example command-line client). - * [Picugen](http://patrickmylund.com/projects/picugen/) - A general-purpose hash/checksum digest generator. - * [simple-sstable](https://github.com/akmistry/simple-sstable) - A simple, no-frills SSTable format and implementation in Go. - * [tribool](https://github.com/saschpe/tribool) - Ternary (tree-valued) logic for Go - * [Tuple](https://bitbucket.org/gotamer/tuple) - Tuple is a go type that will hold mixed types / values - * [vcard](https://bitbucket.org/llg/vcard) - Reading and writing vcard file in go. Implementation of RFC 2425 (A MIME Content-Type for Directory Information) and RFC 2426 (vCard MIME Directory Profile). - * [weightedrandom](https://github.com/minaguib/weightedrandom) - A library for efficient weighted random picking - * [xlsx](https://github.com/tealeg/xlsx) - A library to help with extracting data from Microsoft Office Excel XLSX files. - -## Databases - -See also [[SQLDrivers page|SQLDrivers]]. - -### CockroachDB - * [cockroachdb](https://github.com/cockroachdb/cockroach) - A Scalable, Survivable, Strongly-Consistent SQL Database - -### Hazelcast IMDG - * [Hazelcast IMDG Go Client](https://github.com/hazelcast/hazelcast-go-client) - The official Go client implementation for [Hazelcast IMDG](http://hazelcast.org), the open source in-memory data grid. - -### MongoDB - - * [Mongo Driver](https://github.com/mongodb/mongo-go-driver) - Official MongoDB Go driver - * [MongoDB Exporter](https://github.com/percona/mongodb_exporter) - A Prometheus metrics exporter for MongoDB - * [mongobetween](https://github.com/coinbase/mongobetween) - A lightweight MongoDB connection pooler written in Golang - * [rocks-stata](https://github.com/facebookgo/rocks-strata) - MongoDB Backup Utility - -### MySQL - - * [Go-MySQL-Driver](https://github.com/go-sql-driver/mysql) - A lightweight and fast MySQL-Driver for Go's database/sql package - * [MyMySQL](https://github.com/ziutek/mymysql) - MySQL Client API written entirely in Go. - * [mysqlsuperdump](https://github.com/hgfischer/mysqlsuperdump) - Generate partial and filtered dumps of MySQL databases - * [TiDB](https://github.com/pingcap/tidb) - MySQL compatible distributed database modeled after Google's F1 design. - * [vitess](https://github.com/youtube/vitess) - Scaling MySQL databases for the web - -### ODBC - - * [go-odbc](https://github.com/weigj/go-odbc) - ODBC Driver for Go - * [odbc3-go](https://bitbucket.org/rj/odbc3-go/) - This package is wrapper around ODBC (version 3). - -### PostgreSQL - - * [`code.soquee.net/migrate`](https://code.soquee.net/migration/) A library for generating, applying, and listing PostgreSQL database migrations using a mechanism that's compatible with Rust's Diesel. - * [go-libpq](https://github.com/jgallagher/go-libpq) - cgo-based Postgres driver for Go's database/sql package - * [go-pgsql](https://github.com/lxn/go-pgsql) - A PostgreSQL client library for Go - * [kallax](https://github.com/src-d/go-kallax) - PostgreSQL typesafe ORM - * [pgsql.go](https://github.com/jbarham/pgsql.go) - PostgreSQL high-level client library wrapper - * [pgx](https://github.com/JackC/pgx) - Go PostgreSQL driver that is compatible with database/sql and has native interface for more performance and features - * [pq](https://github.com/lib/pq) - Pure Go PostgreSQL driver for database/sql - * [yoke](https://github.com/nanopack/yoke) - Postgres high-availability cluster with auto-failover and automated cluster recovery - -### QL - - * [ql](https://github.com/cznic/ql) - A pure Go embedded (S)QL database. - -### Redis - - * [godis](https://github.com/simonz05/godis) - Simple client for Redis - * [Go-Redis](https://github.com/alphazero/Go-Redis) - Client and Connectors for Redis key-value store - * [go-redis](https://github.com/fiorix/go-redis) - Redis client built on the skeleton of gomemcache - * [Redigo](https://github.com/garyburd/redigo) - Go client for Redis. - * [redis](https://github.com/vmihailenco/redis) - Redis client for Go - * [rueidis](https://github.com/rueian/rueidis) - Fast Redis RESP3 client that supports client side caching and auto pipelining. - -### [RethinkDB](http://www.rethinkdb.com/) - - * [GoRethink](https://github.com/dancannon/gorethink) - RethinkDB Driver for Go - -### SQLite - - * [gosqlite3](https://github.com/kuroneko/gosqlite3) - Go Interface for SQLite3 - * [gosqlite (forked)](https://github.com/gwenn/gosqlite) - A fork of gosqlite - * [gosqlite](http://code.google.com/p/gosqlite/) - a trivial SQLite binding for Go. - * [go-sqlite](https://github.com/mxk/go-sqlite) - A database/sql driver and standalone sqlite3 interface - * [go-sqlite-lite](https://github.com/bvinc/go-sqlite-lite) - A simple SQLite package for Go. - * [mattn's go-sqlite3](https://github.com/mattn/go-sqlite3) - sqlite3 driver conforming to the built-in database/sql interface - -### Vertica - - * [vertica-sql-go](https://github.com/vertica/vertica-sql-go) - A pure Go driver for Vertica database. - -### ORM - - * [beedb](https://github.com/astaxie/beedb) - beedb is an ORM for Go. It lets you map Go structs to tables in a database - * [ent](https://github.com/facebookincubator/ent) - An entity framework for Go - * [FilterXorm](https://github.com/howcrazy/filterxorm) - Build conditions for xorm project. - * [go-modeldb](https://github.com/jaekwon/go-modeldb) - A simple wrapper around sql.DB for struct support. - * [gorm](https://github.com/jinzhu/gorm) - An ORM library for Go, aims for developer friendly - * [gorp](https://github.com/coopernurse/gorp) - SQL mapper for Go - * [go-firestorm](https://github.com/jschoedt/go-firestorm) - Simple Go ORM for Cloud Firestore - * [go-store](https://github.com/gosuri/go-store) - Data-store library for Go that provides a set of platform-independent interfaces to persist and retrieve key-value data. - * [hood](https://github.com/eaigner/hood) - Database agnostic ORM for Go. Supports Postgres and MySQL. - * [lore](https://github.com/abrahambotros/lore) - Simple and lightweight pseudo-ORM/pseudo-struct-mapping environment for Go. - * [qbs](https://github.com/coocood/qbs) - Query By Struct. Supports MySQL, PostgreSQL and SQLite3. - * [sqlboiler](https://github.com/volatiletech/sqlboiler) - Database-first ORM via code generation. - * [sqlgen](https://github.com/drone/sqlgen) - Go code generation for SQL interaction. - * [structable](https://github.com/Masterminds/structable) - Struct-to-table database mapper. - * [xorm](https://github.com/go-xorm/xorm) - Simple and Powerful ORM for Go. - * [reform](https://github.com/AlekSi/reform) - A better ORM for Go, based on non-empty interfaces and code generation. - * [go-queryset](https://github.com/jirfag/go-queryset) - 100% type-safe ORM for Go with code generation and MySQL, PostgreSQL, Sqlite3, SQL Server support. - -### Key-Value-Stores - - * [bolt](https://github.com/boltdb/bolt) - Persistent key/value store inspired by LMDB. - * [dbm](https://github.com/cznic/exp/tree/master/dbm) - Package dbm (WIP) implements a simple database engine, a hybrid of a hierarchical and/or a key-value one. - * [fs2/bptree](https://github.com/timtadh/fs2#b+tree) - A memory mapped B+Tree with duplicate key support. Appropriate for large amounts of data (aka +100 GB). Supports both anonymous and file backed memory maps. - * [Diskv](https://github.com/peterbourgon/diskv) - Home-grown, disk-backed key-value store - * [etcd](https://github.com/coreos/etcd) - Highly-available key value store for shared configuration and service discovery - * [olric](https://github.com/buraksezer/olric) Distributed cache and in-memory key/value data store. It can be used both as an embedded Go library and as a language-independent service. - * [gkvlite](https://github.com/steveyen/gkvlite) - Pure go, simple, ordered, atomic key-value persistence based on append-only file format. - * [gocask](http://code.google.com/p/gocask/) - Key-value store inspired by Riak Bitcask. Can be used as pure go implementation of dbm and other kv-stores. - * [goleveldb](https://github.com/syndtr/goleveldb) - Another implementation of LevelDB key/value in pure Go. - * [kv](http://github.com/cznic/kv) - Yet another key/value persistent store. Atomic operations, two phase commit, automatic crash recovery, ... - * [leveldb-go](http://code.google.com/p/leveldb-go/) - This is an implementation of the LevelDB key/value database. - * [levigo](https://github.com/jmhodges/levigo) - levigo provides the ability to create and access LevelDB databases. - * [persival](https://github.com/nu7hatch/persival) - Programatic, persistent, pseudo key-value storage - -### Graph Databases - - * [cayley](https://github.com/google/cayley) - 100% Go graph database, inspired by Freebase and the Google Knowledge Graph. - * [Dgraph](https://github.com/dgraph-io/dgraph) - Fast, Distributed Graph DB with a GraphQL-like API. - * [go-gremlin](https://github.com/go-gremlin/gremlin) - A Go client for the Apache TinkerTop Graph analytics framework (Gremlin server). - -### NoSQL - - * [couchgo](https://github.com/lancecarlson/couchgo) - The most feature complete CouchDB Adapter for Go. Modeled after couch.js. - * [influxdb](https://github.com/influxdb/influxdb) - Scalable datastore for metrics, events, and real-time analytics - * [Kivik](https://github.com/go-kivik/kivik) - Kivik provides a common Go and GopherJS client library for CouchDB, PouchDB, and similar databases. - * [ledisdb](https://github.com/siddontang/ledisdb) - A high performance NoSQL like Redis. - * [nodb](https://github.com/lunny/nodb) - A pure Go embed Nosql database with kv, list, hash, zset, bitmap, set. - * [tiedot](https://github.com/HouzuoGuo/tiedot) - A NoSQL document database engine using JSON for documents and queries; it can be embedded into your program, or run a stand-alone server using HTTP for an API. - -### Other - - * [cabinet](https://bitbucket.org/ww/cabinet) - Kyoto Cabinet bindings for go - * [camlistore](https://github.com/camlistore/camlistore) - Personal distributed storage system for life. - * [cdb.go](https://github.com/jbarham/cdb.go) - Create and read cdb ("constant database") files - * [CodeSearch](https://github.com/google/codesearch) - Index and perform regex searches over large bodies of source code - * [dbxml](https://github.com/pebbe/dbxml) - A basic interface to Oracle Berkeley DB XML - * [drive](https://github.com/odeke-em/drive) - A Google drive command line client - * [Event Horizon](https://github.com/looplab/eventhorizon) - Toolkit for Command Query Responsibility Segregation and Event Sourcing (CQRS/ES) - * [go-batcher](https://github.com/yyh1102/go-batcher) - Simply create and use batch handler in Go - * [go-clickhouse](https://github.com/roistat/go-clickhouse) - Connector to Yandex Clickhouse (column-oriented database) - * [go-db-oracle](https://code.google.com/p/go-db-oracle/) - GO interface to Oracle DB - * [gographite](https://github.com/amir/gographite) - statsd server in go (for feeding data to graphite) - * [gokabinet](https://github.com/fsouza/gokabinet) - Go bindings for Kyoto Cabinet DBM implementation - * [go-model](https://github.com/jeevatkm/go-model) - Robust & Easy to use struct mapper and utility methods for Go - * [go-notify](https://github.com/lenormf/go-notify) - GO bindings for the libnotify - * [goprotodb](http://launchpad.net/goprotodb) - A binding to Berkeley DB storing records encoded as Protocol Buffers. - * [go-rexster-client](https://github.com/sqs/go-rexster-client) - Go client for the [Rexster graph server](https://github.com/tinkerpop/rexster/wiki) (part of the [TinkerPop](http://www.tinkerpop.com/) suite of graph DB tools) - * [goriak](https://bitbucket.org/lateefj/goriak/overview) - Database driver for riak database (project homepage is now on bitbucket.org) - * [goriakpbc](https://github.com/tpjg/goriakpbc) - Riak driver using Riak's protobuf interface - * [gotyrant](https://github.com/patrickxb/gotyrant) - A Go wrapper for tokyo tyrant - * [go-wikiparse](https://github.com/dustin/go-wikiparse) - mediawiki dump parser for working with wikipedia data - * [hdfs](https://github.com/zyxar/hdfs) - go bindings for libhdfs - * [JGDB](http://www.robotamer.com/html/GoTamer/JGDB.html) - JGDB stands for Json Git Database - * [mig](https://github.com/jagregory/mig) - Simple SQL-based database migrations - * [mongofixtures](https://github.com/OwlyCode/mongofixtures) - A Go quick and dirty utility for cleaning MongoDB collections and loading fixtures into them. - * [Neo4j-GO](https://github.com/davemeehan/Neo4j-GO) - Neo4j REST Client in Go - * [neoism](https://github.com/jmcvetta/neoism) - Neo4j graph database client, including Cypher and Transactions support. - * [null](https://github.com/guregu/null) - Package for handling null values in SQL - * [Optimus Cache Prime](http://patrickmylund.com/projects/ocp/) - Smart cache preloader for websites with XML sitemaps. - * [piladb](https://github.com/fern4lvarez/piladb) - Lightweight RESTful database engine based on stack data structures. - * [pravasan](https://pravasan.github.io/pravasan) - Simple Migration Tool (like rake db:migrate with more flexibility) - * [remapper](https://github.com/plandem/remapper) - library to convert/map data from one type to another - * [riako](https://github.com/jkassemi/riako) - High level utility methods for interacting with Riak databases - * [sqlbuilder](https://github.com/thcyron/sqlbuilder) - SQL query builder with row mapping - * [sqlf](https://github.com/keegancsmith/sqlf) - Create parameterized SQL statements in Go, sprintf style - * [squirrel](https://github.com/lann/squirrel) - Fluent SQL generation for Go - * [Sublevel](https://github.com/fiatjaf/sublevel) - Separate sections of the same LevelDB - * [Weed File System](https://github.com/chrislusf/seaweedfs) - fast distributed key-file store - * [whisper-go](https://github.com/kisielk/whisper-go) - library for working with whisper databases - * [xo](https://github.com/xo/xo) - CLI to generate idiomatic Go code for databases - -## Date - - * [date](https://github.com/fxtlabs/date) - A package for working with dates. - * [date](https://github.com/rickb777/date) - For dates, date ranges, time spans, periods, and time-of-day. - * [goment](https://github.com/nleeper/goment) - Go time library inspired by Moment.js - * [gostrftime](https://github.com/cactus/gostrftime) - strftime(3) like formatting for time.Time - * [hijri](https://github.com/younisshah/hijri) - A small helper library to convert a Hijri date to a Gregorian date according to Ummul Qura calendar. - * [now](https://github.com/jinzhu/now) - Now is a time toolkit for golang. - * [tai64](https://github.com/cactus/tai64) - tai64 and tai64n parsing and formatting - * [Tideland golib](https://github.com/tideland/golib) - Timex extensions - * [tuesday](https://github.com/osteele/tuesday) - A Strftime implementation that's compatible with Ruby's `Time.strftime` - -## Development Tools - - * [cwrap](https://github.com/hailiang/cwrap) - Go wrapper (binding) generator for C libraries. - * [demand](https://github.com/tv42/demand) - Download, build, cache and run a Go app easily. - * [glib](https://github.com/ziutek/glib) - Bindings for GLib type system - * [go-callvis](https://github.com/TrueFurby/go-callvis) - Visualize call graph of your Go program using dot format. - * [gocog](https://github.com/natefinch/gocog) - A code generator that can generate code using any language - * [godepgraph](https://github.com/kisielk/godepgraph) - Create a dependency graph for a go package - * [godev](https://github.com/kdar/godev) - Recompiles and runs your Go code on source change. Also watches all your imports for changes. - * [godiff](https://github.com/spcau/godiff) - diff file comparison tool with colour html output - * [GoNB](https://github.com/janpfeifer/gonb) - Interactive Go programming with Jupyter Notebooks. - * [gonew](https://github.com/bmatsuo/gonew) - A tool to create new Go projects - * [go-play](https://code.google.com/p/go-play) - A HTML5 web interface for experimenting with Go code. Like https://go.dev/doc/play but runs on your computer - * [gore](https://github.com/motemen/gore) - A Go REPL. Featured with line editing, code completion, and more - * [gorun](https://wiki.ubuntu.com/gorun) - Enables Go source files to be used as scripts. - * [go-spew](https://github.com/davecgh/go-spew) - Implements a deep pretty printer for Go data structures to aid in debugging - * [goven](https://github.com/kr/goven) - Easily copy code from another project into yours - * [gowatcher](https://github.com/nickjj/gowatcher) - Reload a specified go program automatically by monitoring a directory. - * [GoWatch](https://bitbucket.org/gotamer/gowatch) - GoWatch watches your dev folder for modified files, and if a file changes it restarts the process. - * [goweb](https://bitbucket.org/santucco/goweb) - Literate programming tools for Go based on CWEB by Donald Knuth and Silvio Levy. - * [goyaccfmt](https://github.com/wangkuiyi/goyaccfmt) - Auto reformat Goyacc source files. - * [hopwatch](https://github.com/emicklei/hopwatch) - simple debugger for Go - * [hsandbox](http://labix.org/hsandbox) - Tool for quick experimentation with Go snippets - * [Inject](https://github.com/facebookgo/inject) - Library for dependency injection in Golang (from Facebook) - * [liccor](https://github.com/gtalent/liccor) - A tool for updating license headers in Go source files - * [liteide](https://github.com/visualfc/liteide) - An go auto build tools and qt-based ide for Go - * [Livedev](https://github.com/qrtz/livedev) - Livedev is a development proxy server that enables live code reloading. - * [Martian](https://github.com/google/martian) - HTTP proxy designed for use in E2E testing. - * [nvm-windows](https://github.com/coreybutler/nvm-windows) - Node.js version manager for Windows - * [prettybenchcmp](https://github.com/im7mortal/prettybenchcmp) - Store and compare benchmarks history locally. - * [rerun](https://github.com/skelterjohn/rerun) - Rerun watches your binary and all its dependencies so it can rebuild and relaunch when the source changes. - * [sling](https://github.com/alexstov/sling) - Network traffic simulator and test automation tool to send file requests through the HTTP or TCP protocol, control rate frequency, number of concurrent connections, delays, timeouts, and collect the response time statistics, mean, and percentiles. - * [syntaxhighlighter](https://github.com/sourcegraph/syntaxhighlight) - language-independent code syntax highlighting library - * [toggle](https://github.com/xchapter7x/toggle) - A feature toggle library with built in support for environment variable backed toggling. pluggable backing engine support. - * [trace](https://bitbucket.org/santucco/trace) - A simple debug tracing - -### Emacs Tags - - * [egotags](http://bitbucket.org/scriptdevil/egotags/) - ETags generator - * [tago1](https://github.com/willoch/tago) - etags generator for go that builds with go 1 - * [tago](https://github.com/AlexCombas/Tago) - Emacs TAGS generator for Go source - -## Distributed/Grid Computing - - * [celeriac](https://github.com/svcavallar/celeriac.v1) - A library for adding support for interacting and monitoring Celery workers, tasks and events in Go - * [donut](https://github.com/dforsyth/donut) - A library for building clustered services in Go - * [libchan](https://github.com/docker/libchan) - Go-like channels over the network - * [locker](https://github.com/jagregory/locker) - A distributed lock service built on top of [etcd](https://github.com/coreos/etcd). - * [dlock](https://github.com/temoto/dlock) - A native Go distributed lock manager (client and server) using gRPC. - * [mangos](https://github.com/gdamore/mangos) - An implementation of the Scalable Protocols based on [nanomsg](http://nanomsg.org/) - * [redsync](https://github.com/hjr265/redsync.go) - Redis-based distributed mutual exclusion lock implementation - * [Skynet](https://github.com/skynetservices/skynet) - Skynet is distributed mesh of processes designed for highly scalable API type service provision. - * [Tideland golib](https://github.com/tideland/golib) - Includes a map/reduce library - -## Documentation - - * [examplgen](https://github.com/gima/examplgen) - Insert code from .go files to documents (examples to project's readme, for instance). - * [godocdown](https://github.com/robertkrimen/godocdown) - Format package documentation (godoc) as GitHub friendly Markdown - * [golangdoc](https://github.com/golang-china/golangdoc) - Godoc for Golang, support translate. - * [Mango](http://code.google.com/p/mango-doc/) - Automatically generate unix man pages from Go sources - * [redoc](https://github.com/simonz05/redoc) - Commands documentation for Redis - * [sphinxcontrib-golangdomain](http://pypi.python.org/pypi/sphinxcontrib-golangdomain) - Sphinx domain for Go - * [test2doc](https://code.google.com/p/test2doc/) - Generate documentation for your go units from your unit tests. - -## Editors - - * [A](https://github.com/as/a) - A graphical text and binary editor based on Acme - * [Conception](https://github.com/shurcooL/Conception) - Conception is an experimental research project, meant to become a modern IDE/Language package. [demo video](http://youtu.be/DNJ7HqlV55k) - * [de](https://github.com/driusan/de) - A modal graphical editor with Acme and vi features - * [Gide](https://github.com/goki/gide) - Go IDE built in the go-native [GoGi](https://github.com/goki/gi) GUI - * [Go-bbpackage](https://github.com/ascarter/Go-bbpackage) - BBEdit package for Go development - * [goclipse](https://github.com/GoClipse/goclipse) - An Eclipse-based IDE for Go. - * [Go conTEXT](http://www.tc33.org/go/go-programming-highlighter-for-context-editor/) - Highlighter plugin - * [godev](https://github.com/sirnewton01/godev) - Web-based IDE for the Go language - * [godit](https://github.com/nsf/godit) - A microemacs-like text editor written in Go. - * [gofinder](https://github.com/mpl/gofinder) - (code) search tool for acme - * [go-gedit](http://code.google.com/p/go-gedit3-plugin/) - Google Go language plugin for gedit - * [golab](https://github.com/mb0/lab) - go local application builder - a web-based Go ide - * [Google Go for Idea](http://plugins.intellij.net/plugin/?idea&id=5047) - Google Go language plugin for Intellij IDEA - * [micro](https://github.com/zyedidia/micro) - A modern and intuitive terminal-based text editor. - * [tabby](https://github.com/mikhailt/tabby) - Source code editor - * [T](https://github.com/eaburns/T) - An Acme/Sam like text editor - * [ViGo](https://github.com/kisielk/vigo) - A vim-like text editor. - * [Wide](https://github.com/b3log/wide) - A Web-based IDE for Teams using Golang. - -## Email - - * [chasquid](https://blitiri.com.ar/p/chasquid) - SMTP server written in Go. - * [gmail](https://github.com/SlyMarbo/gmail) - Simple library for sending emails from a Gmail account, for people not interested in dealing with protocol details. - * [Gomail](https://github.com/go-mail/mail) - A simple and efficient package to send emails. - * [go-mail](https://github.com/ungerik/go-mail) - Email utilities including RFC822 messages and Google Mail defaults. - * [go-ses](https://github.com/sourcegraph/go-ses) - Amazon AWS Simple Email Service (SES) API client - * [go-simple-mail](https://github.com/xhit/go-simple-mail) - "Golang package for send email. Support keep alive connection, TLS and SSL. Easy for bulk SMTP." - * [Hectane](https://github.com/hectane/hectane) - Lightweight SMTP client including a built-in mail queue backed by on-disk storage. - * [Inbucket](http://jhillyerd.github.io/inbucket/) - Inbucket is an email testing service; it will accept messages for any email address and make them available to view via a web interface. - * [mail.go](https://bitbucket.org/taruti/mail.go) - Parse email messages - * [MailHog](https://github.com/mailhog/MailHog) - Email testing service, inspired by MailCatcher. - * [MailSlurper](https://github.com/mailslurper/mailslurper) - A handy SMTP mail server useful for local and team application development. Slurp mail into oblivion! - -## Error handling - - * [`code.soquee.net/problem`](https://code.soquee.net/problem/) Package problem implements errors for HTTP APIs similar to the ones described by [RFC7807](https://tools.ietf.org/html/rfc7807). - * [errgo](https://github.com/juju/errgo) - Error tracing and annotation. - * [errors](https://github.com/aletheia7/errors) - errors augments and error with a file and line number. - * [errors](https://github.com/juju/errors) - The juju/errors package provides an easy way to annotate errors without losing the original error context, and get a stack trace back out of the error for the locations that were recorded. - * [goerr](https://github.com/goerr/goerr) - Allows to make a separate(modular) and reusable error handlers. Exception-like panic() recover() mechanism using Return(error) and catching err := OR1(..) - * [hierr](https://github.com/reconquest/hierr-go) - Nesting errors in hierarchy. - * [panicparse](https://github.com/maruel/panicparse/) - Parse panics with style. - * [Space Monkey errors](https://github.com/spacemonkeygo/errors) - Go's missing errors library - stack capture, error hierarchies, error tags - * [Tideland golib](https://github.com/tideland/golib) - Detailed error values - -## Encodings and Character Sets - - * [base58](https://github.com/tv42/base58) - Human input-friendly base58 encoding - * [bencode-go](https://github.com/jackpal/bencode-go) - Encoding and decoding the bencode format used by the BitTorrent peer-to-peer file sharing protocol - * [bsonrpc](https://github.com/skelterjohn/bsonrpc) - BSON codec for net/rpc - * [chardet](https://github.com/saintfish/chardet) - Charset detection library ported from ICU - * [charmap](https://github.com/disintegration/charmap) - Character encodings in Go - * [codec-msgpack-binc](https://github.com/ugorji/go/tree/master/codec#readme) High Performance and Feature-Rich Idiomatic Go Library providing encode/decode support for multiple binary serialization formats: [msgpack](http://www.msgpack.org) - * [colfer](https://github.com/pascaldekloe/colfer) - high-performance binary codec - * [gobson](http://labix.org/gobson) - BSON (de)serializer - * [go-charset](http://code.google.com/p/go-charset/) - Conversion between character sets. Native Go. - * [go.enmime](https://github.com/jhillyerd/go.enmime) - MIME email parser library for Go (native) - * [go-msgpack](https://github.com/ugorji/go-msgpack) - Comprehensive MsgPack library for Go, with pack/unpack and net/rpc codec support (DEPRECATED in favor of [codec](https://github.com/ugorji/go/tree/master/codec#readme) ) - * [gopack](https://github.com/joshlf13/gopack) - Bit-packing for Go - * [go-simplejson](https://github.com/bitly/go-simplejson) - a Go package to interact with arbitrary JSON - * [go-wire](https://github.com/tendermint/go-wire) - Binary and JSON codec for structures and more - * [go-xdr](https://github.com/davecgh/go-xdr) - Pure Go implementation of the data representation portion of the External Data Representation (XDR) standard protocol as specified in RFC 4506 (obsoletes RFC 1832 and RFC 1014). - * [iconv-go](https://github.com/djimenez/iconv-go) - iconv wrapper with Reader and Writer - * [magicmime](https://github.com/rakyll/magicmime) -- Mime-type detection with Go bindings for libmagic - * [Mahonia](http://code.google.com/p/mahonia/source/browse/) - Character-set conversion library in Go - * [mimemagic](https://bitbucket.org/taruti/mimemagic) - Detect mime-types automatically based on file contents with no external dependencies - * [mimemagic](https://github.com/zRedShift/mimemagic) - A pure-Go MIME sniffing library/tool based on the FreeDesktop.org spec - * [msgpack](https://github.com/vmihailenco/msgpack) - Msgpack format implementation for Go - * [msgpack-json](https://github.com/tv42/msgpack-json) - Command-line utilities to convert between msgpack and json - * [nnz](https://sourcegraph.com/github.com/sourcegraph/go-nnz) - String and Int primitives that serialize to JSON and SQL null - * [storable](https://github.com/kdar/storable) - Write perl storable data - * [TNetstring](https://github.com/edsrzf/tnetstring-go) - tnetstrings (tagged Netstrings) - -## File Systems - - * [afero](https://github.com/spf13/afero) - A File Sytem abstraction system for Go - * [go.fs](https://github.com/daaku/go.fs) - A virtual file system abstraction layer. - * [poller](https://github.com/npat-efault/poller) - Package poller is a file-descriptor multiplexer. It allows concurent Read and Write operations from and to multiple file-descriptors. - * [vfsgen](https://github.com/shurcooL/vfsgen) - Generates a vfsdata.go file that statically implements the given virtual filesystem. - - -## Games - - * [Bampf](https://github.com/gazed/bampf) - Arcade style game based on the Vu 3D engine. - * [bloxorz](https://github.com/YouriAckx/bloxorz) - Solver for bloxorz basic levels - * [ChessBuddy](https://github.com/tux21b/ChessBuddy) - Play chess with Go, HTML5, WebSockets and random strangers! - * [Fergulator](https://github.com/scottferg/Fergulator) - An NES emulator, using SDL and OpenGL - * [FlappyBird](https://github.com/himanshushekhar/golang-flappybirdclone) - A simple flappy bird clone written in golang. - * [godoku](http://code.google.com/p/kylelemons/source/browse?repo=godoku) - Go Sudoku Solver - example of "share by communicating" - * [Gongo](https://github.com/skybrian/Gongo) - A program written in Go that plays Go - * [gospeccy](https://github.com/remogatto/gospeccy) - A ZX Spectrum 48k Emulator - * [Ludo Game](http://ludo.abiosoft.net) - Ludo Board game powered by Go on Appengine - * [pinkman](https://github.com/jubalh/pinkman) - command line based chess interface to UCI compatible chess engines - * [Pong](https://github.com/LaurenceGA/Pong) - A simple Pong clone written in golang - * [pong-command](https://github.com/kurehajime/pong-command) - Joke command,ping-like pong. - * [Steven](https://github.com/thinkofdeath/steven) - A Minecraft client in Go - * [ukodus](https://github.com/9nut/ukodus) - Sudoku solver in Go - * [WolfenGo](https://github.com/gdm85/wolfengo) - A Wolfenstein3D clone in Go, using OpenGL 2.1 - * [GoChess](https://github.com/qnkhuat/gochess) - Play chess with friends on terminal - * [Ebitengine](https://ebitengine.org/) - Ebitengine's simple API allows you to quickly and easily develop 2D games that can be deployed across multiple platforms. - -## GIS - - * [geojson](https://github.com/kpawlik/geojson) - Go package to quick and easy create json data in geojson format. [description](http://kpawlik.github.io/geojson) - * [go-geom](https://github.com/twpayne/go-geom) - Efficient Open Geo Consortium-style geometries with native Go GeoJSON and WKB encoding and decoding (work-in-progress) - * [go.geo](https://github.com/paulmach/go.geo) - Geometry/geography library targeted at online mapping (deprecated by author in favor of his new gis library `orb`.) - * [go.geojson](https://github.com/paulmach/go.geojson) - Marshalling and Unmarshalling of GeoJSON objects - * [gogeos](http://paulsmith.github.io/gogeos/) - Go library for spatial data operations and geometric algorithms - * [go-proj-4](https://github.com/pebbe/go-proj-4) - An interface to the Cartographic Projections Library PROJ.4 - * [go-kml](https://github.com/twpayne/go-kml) - Google Earth KML generation - * [go-polyline](https://github.com/twpayne/go-polyline) - Google Maps polyline encoding and decoding - * [orb](https://github.com/paulmach/orb) - 2d geometry manipulation (length, area, polygon contains, etc.) with geojson, wkb, mvt support - * [osm](https://github.com/paulmach/osm) - General purpose library for reading, writing and working with OpenStreetMap data - * [UTM](https://github.com/im7mortal/UTM) - Bidirectional UTM-WGS84 converter - * [gdal](https://github.com/lukeroth/gdal) - Provides a go wrapper for GDAL - -## Graphics and Audio - - * [accumimage](https://github.com/spakin/accumimage) - Variant of [`image.NRGBA`](https://pkg.go.dev/image#NRGBA) and [`color.NRGBA`](https://pkg.go.dev/image/color#NRGBA) that supports accumulation and averaging of colors - * [AnsiGo](https://github.com/fcambus/ansigo) - Simple ANSi to PNG converter written in pure Go - * [Arclight](http://www.angryredplanet.com/exh/arclight/) - Arclight is a tool for rendering images - * [bild](https://github.com/anthonynsimon/bild) - A collection of image processing algorithms in pure Go - * [bimg](https://github.com/h2non/bimg) - Small Go library for fast image resize and transformation using libvips - * [blend](https://github.com/Phrozen/blend) - Image processing library and rendering toolkit for Go. - * [bpg](https://github.com/chai2010/bpg) - BPG decoder for Go. - * [chart](https://github.com/vdobler/chart) - Library to generate common chart (pie, bar, strip, scatter, histogram) in different output formats. - * [cpio](https://github.com/cavaliergopher/cpio) - Readers and writers for the CPIO archive file format. - * [draw2d](https://github.com/llgcode/draw2d) - This package provide an API to draw 2d geometrical form on images. This library is largely inspired by postscript, cairo, HTML5 canvas. - * [ebiten](https://ebiten.org/) - A cross platform open-source game library with which you can develop 2D games with simple API for multi platforms. Cgo/c compiler setup not needed. - * [egl](https://pkg.go.dev/github.com/mortdeus/egles/egl) - egl bindings - * [es2](https://pkg.go.dev/github.com/mortdeus/egles/es2) - es2 bindings - * [fastgallery](https://github.com/tonimelisma/fastgallery) - A fast static image and video web gallery generator - * [fourcc](https://github.com/reiver/go-fourcc) - Go implementation of FOURCC (four character code) (4CC) identifiers for a video codecs, compression formats, colors, and pixel format used in media files. - * [freetype-go](http://code.google.com/p/freetype-go/) - a Go implementation of FreeType - * [glfw 3](https://github.com/go-gl/glfw3) - Go bindings for GLFW 3 library - * [glfw](https://github.com/go-gl/glfw) - bindings to the multi-platform library for opening a window, creating an OpenGL context and managing input - * [glh](https://github.com/go-gl/glh) - OpenGL helper functions to manage text, textures, framebuffers and more - * [gl](https://github.com/go-gl/gl) - OpenGL bindings using glew - * [gltf](https://github.com/sturfeeinc/glTF) - library for marshaling and unmarshaling glTF - * [glu](https://github.com/go-gl/glu) - bindings to the OpenGL Utility Library - * [glui](https://github.com/jphsd/glui) - Wrapper for glfw to simplify displaying an image - * [gmask](https://github.com/fggp/gmask) - Go adaptation of the Cmask utility for Csound - * [goalsa](https://github.com/cocoonlife/goalsa) - Go bindings for ALSA capture and playback - * [go-cairo](https://github.com/ungerik/go-cairo) - Go wrapper for the cairo graphics library - * [gocl](https://github.com/rainliu/gocl) - Go OpenCL (gocl) binding, support OpenCL 1.1/1.2/2.0 on Mac/Linux/Windows/Android - * [go-colorful](https://github.com/lucasb-eyer/go-colorful) - Color spaces conversions and other color-space operations - * [go-csnd6](https://github.com/fggp/go-csnd6) - Go binding to the Csound6 API - * [go-csperfthread](https://github.com/fggp/go-csperfthread) - Go binding to the CsoundPerformanceThread helper class of the Csound6 API - * [goexif](https://github.com/rwcarlsen/goexif) - Retrieve EXIF metadata from image files - * [gofb](https://github.com/rostislavjadavan/gofb) - Go framebuffer library for drawing pixel by pixel - * [goflac](https://github.com/cocoonlife/goflac) - Go bindings for decoding and encoding FLAC audio with libFLAC - * [go-gd](https://github.com/bolknote/go-gd) - Go bingings for GD - * [GoGL](https://github.com/chsc/GoGL) - OpenGL binding generator - * [go-gnuplot](https://github.com/sbinet/go-gnuplot) - go bindings for Gnuplot - * [go-gtk3](https://github.com/norisatir/go-gtk3) - gtk3 bindings for go - * [go-heatmap](https://github.com/dustin/go-heatmap) - A toolkit for making heatmaps - * [GoHM](https://github.com/rainliu/GoHM) - H.265/HEVC HM Video Codec in Go - * [goHorde](https://bitbucket.org/tshannon/gohorde/src) - Go Bindings for the Horde3d Rendering engine. - * [GoMacDraw](https://github.com/skelterjohn/gmd) - A mac implementation of go.wde - * [go-openal](https://github.com/phf/go-openal) - Experimental OpenAL bindings for Go - * [go-opencl](https://github.com/tones111/go-opencl) - A go wrapper to the OpenCL heterogeneous parallel programming library - * [go-opencv](https://github.com/lazywei/go-opencv) - Go bindings for OpenCV / 2.x API in gocv / 1.x API in opencv - * [Go-OpenGL](https://github.com/banthar/Go-OpenGL) - Go bindings for OpenGL - * [Goop](https://github.com/peterbourgon/goop) - Audio synthesizer engine - * [goray](http://goray.sourceforge.net/) - Raytracer written in Go, based on Yafaray - * [gosc](https://bitbucket.org/liamstask/gosc) - Pure Go OSC (Open Sound Control) library - * [go-taglib](https://github.com/wtolson/go-taglib) - Go wrapper for TagLib, an audio meta-data parser - * [go-tmx](https://github.com/salviati/go-tmx) - A Go library that reads Tiled's TMX files - * [govips](https://github.com/davidbyttow/govips) - A lightning fast Go image processing and resizing library - * [GoVisa](https://github.com/rainliu/GoVisa) - H265/HEVC Bitstream Analyzer in Go - * [go-vlc](https://github.com/jteeuwen/go-vlc) - Go bindings for libVLC - * [go.wde](https://github.com/skelterjohn/go.wde) - A windowing/drawing/event interface - * [goxscr](http://goxscr.googlecode.com) - Go rewrites of xscreensaver ports - * [graphics2d](https://github.com/jphsd/graphics2d) - Path and path transform based 2D graphics package - * [gst](https://github.com/ziutek/gst) - Go bindings for GStreamer - * [gumble](https://github.com/layeh/gumble) - Client library for the [Mumble](http://mumble.info) VoIP protocol - * [hgui](https://github.com/zozor/hgui) - Gui toolkit based on http and gtk-webkit. - * [hsvimage](https://github.com/spakin/hsvimage) - Support for HSV color models and images - * [imaginary](https://github.com/h2non/imaginary) - Simple and fast HTTP microservice for image resizing and manipulation - * [imaging](https://github.com/disintegration/imaging) - Package imaging provides basic image manipulation functions (resize, rotate, flip, crop, etc.) as well as simplified image loading and saving. - * [imgproxy](https://github.com/DarthSim/imgproxy/issues) - Fast and secure standalone server for resizing and converting remote images - * [libvlc-go](https://github.com/adrg/libvlc-go) - Go bindings for libVLC 2.X/3.X/4.X used by the VLC media player - * [merlin](https://github.com/attron/merlin) - Automatic video encoder - * [netpbm](https://github.com/spakin/netpbm) - Read and write Netpbm images from Go programs - * [opencv](https://github.com/chai2010/opencv/) - Go bindings for OpenCV - * [osmesa](https://github.com/go-gl/osmesa) - Go bindings for osmesa. - * [phono](https://github.com/dudk/phono) - DSP pipeline. - * [Plotinum](https://github.com/gonum/plot) - An API for creating plots - * [portaudio](http://code.google.com/p/portaudio-go/) - A Go binding to PortAudio - * [pulsego](https://github.com/moriyoshi/pulsego/) - Go binding for PulseAudio - * [pulse-simple](https://github.com/mesilliac/pulse-simple/) - Go bindings for PulseAudio's Simple API, for easy audio capture and playback. - * [rasterx](https://github.com/srwiley/rasterx) - SVG-standard rendering, rasterization library. - * [resize](https://github.com/nfnt/resize) - Image resizing with different interpolations. - * [RiGO](https://github.com/mae-global/rigo) - RenderMan Interface implementation in Go. - * [rpm](https://github.com/cavaliergopher/rpm) - Go implementation of the RPM package file format - * [smartcrop](https://github.com/muesli/smartcrop) - Content aware image cropping - * [starfish](https://github.com/gtalent/starfish) - A simple Go graphics and user input library, built on SDL - * [stl](https://github.com/hschendel/stl) - library for reading, writing, and manipulating Stereolithography (.stl) files used in 3D printing - * [svgo](https://github.com/ajstarks/svgo) - a library for creating and outputting SVG - * [tag](https://github.com/dhowden/tag) - a library for reading tag metadata and creating metadata-invariant checksums for audio files: FLAC, all IDv3 variants, and MP4 (ACC, ALAC) - * [texture](https://github.com/jphsd/texture) - Procedurally generated textures based on the Bryce3D deep texture editor - * [tga](https://github.com/ftrvxmtrx/tga) - TARGA image format encoding/decoding library - * [tiff](https://github.com/chai2010/tiff) - Rich TIFF/BigTIFF/GeoTIFF decoder/encoder for Go. - * [twilio-go](https://github.com/kevinburke/twilio-go) - Go client for the Twilio API. - * [videoinput](https://github.com/chai2010/videoinput) - Go bindings for VideoInput (Windows). - * [vu](https://github.com/gazed/vu) - Virtual Universe. A skeleton 3D engine. - * [vulkan](https://github.com/vulkan-go/vulkan) - Golang Bindings for Vulkan API. - * [webp](https://github.com/chai2010/webp) - WebP decoder and encoder for Go. - * [wg](https://github.com/magsoft-se/wg) - Web Graphics, display real time go graphics in browser, with user input. - * [window](https://github.com/jbrukh/window) - Optimized moving window for real-time data - * [xmorph](https://github.com/spakin/xmorph) - Warp and morph images - -## GUIs and Widget Toolkits - - * [fyne](https://github.com/fyne-io/fyne) - Cross platform native GUI toolkit based on Material Design - * [gio](https://gioui.org/) - Portable (iOS/tvOS, Android, Linux (Wayland/X11), macOS, Windows, FreeBSD, OpenBSD, WASM) immediate mode GUI - * [go-fltk](https://github.com/zot/go-fltk) - FLTK2 GUI toolkit bindings for Go - * [imgui-go](https://github.com/allendang/imgui-go) - [Dear ImGui](https://github.com/ocornut/imgui) wrapper library for Go - * [GoGi](https://github.com/goki/gi) - Fully native cross-platform GUI toolkit - * [go-gtk](https://github.com/mattn/go-gtk) - Bindings for GTK - * [go-qt5](https://github.com/salviati/go-qt5) - QT5 bindings for go - * [gothic](https://github.com/nsf/gothic) - Tcl/Tk Go bindings - * [gotk3](https://github.com/gotk3/gotk3) - Go bindings for GTK3, requires GTK version 3.8 - * [go.uik](https://github.com/skelterjohn/go.uik) - A UI kit for Go, in Go. (project is closed) - * [go-webkit2](https://sourcegraph.com/github.com/sourcegraph/go-webkit2) - Go bindings for the WebKitGTK+ v2 API (w/headless browser & JavaScript support) - * [Gowut](https://github.com/icza/gowut) - Gowut (Go Web UI Toolkit) is a full-featured, easy to use, platform independent Web UI Toolkit written in pure Go, no platform dependent native code is linked or called. - * [GXUI](https://github.com/google/gxui) - A Go cross platform UI library. - * [iup](https://github.com/grd/iup) - Bindings for [IUP](http://www.tecgraf.puc-rio.br/iup) - * [lorca](https://github.com/zserge/lorca) - A small library for building cross-platform HTML5 GUI apps in Go, uses Chrome/Chromium as a UI layer. - * [mdtwm](https://github.com/ziutek/mdtwm) - Tiling window manager for X - * [qml](https://github.com/niemeyer/qml) - QML support for the Go language - * [ui](https://github.com/andlabs/ui) - Platform-native GUI library for Go - * [webview](https://github.com/zserge/webview) - Tiny cross-platform web UI library. Uses WebKit (Gtk/Cocoa) and MSHTML (Windows) - * [wingo](https://github.com/BurntSushi/wingo) - A fully-featured window manager written in Go. - * [Winhello](https://github.com/MalcolmJSmith/Winhello) - An example Windows GUI hello world application - * [wxGo](https://github.com/JeroenD/wxGo) - Go Wrapper for the wxWidgets GUI - * [xgb](https://github.com/BurntSushi/xgb) - A fork of the x-go-binding featuring support for thread safety and all X extensions. - * [xgbutil](https://github.com/BurntSushi/xgbutil/) - A utility library to make use of the X Go Binding easier. (Implements EWMH and ICCCM specs, key binding support, etc.) - * [x-go-binding](http://code.google.com/p/x-go-binding/) - bindings for the X windowing system - * [go-sciter](https://github.com/sciter-sdk/go-sciter) - Bindings for the [sciter](https://sciter.com/) - * [go-astilectron](https://github.com/asticode/go-astilectron) - Build cross platform GUI apps with GO and HTML/JS/CSS (powered by [Electron](https://www.electronjs.org/)) - -## Hardware - - * [gobot](https://gobot.io) - Golang framework for robotics, drones, and the Internet of Things (IoT). - * [go.hid](https://github.com/GeertJohan/go.hid) - Provides communication with USB Human Interface Devices. - * [gortlsdr](https://github.com/jpoirier/gortlsdr) - A librtlsdr wrapper, which turns certain USB DVB-T dongles into a low-cost, general purpose software-defined radio receiver. - * [hwio](https://github.com/mrmorphic/hwio) - Hardware I/O library for SoC boards including BeagleBone Black and Raspberry Pi. - * [stressdisk](https://github.com/ncw/stressdisk) - Stress test your disks / memory cards / USB sticks before trusting your valuable data to them - -## Language and Linguistics - - * [alpinocorpus-go](https://github.com/rug-compling/alpinocorpus-go) - A reader and a writer for Alpino corpora. - * [go-aspell](https://github.com/trustmaster/go-aspell) - GNU Aspell spell checking library bindings for Go. - * [go-edlib](https://github.com/hbollon/go-edlib) - Go string comparison and edit distance algorithms library (Levenshtein, LCS, Hamming, Damerau levenshtein, Jaro-Winkler, etc.) compatible with Unicode. - * [go-l10n](https://github.com/xelaj/go-l10n) - localization for humans - * [go-language](https://github.com/matiasinsaurralde/go-language) - A simple language detector using letter frequency data. - * [goling](https://github.com/gyuho/goling) - String Similarity(Cosine Similarity, Levenshtein Distance), Spell Check, Segmentation - * [go-ngram](https://github.com/euskadi31/go-ngram) - An n-gram is a contiguous sequence of n items from a given sequence of text or speech. - * [go.stringmetrics](https://github.com/robyoung/go.stringmetrics) - String distance metrics implemented in Go - * [go-tokenizer](https://github.com/euskadi31/go-tokenizer) - A Text Tokenizer library for Golang - * [inflect](https://bitbucket.org/pkg/inflect) - Word inflection library (similar to Ruby ActiveSupport::Inflector). Singularize(), Pluralize(), Underscore() etc. - * [libtextcat](https://github.com/pebbe/libtextcat) - A Go wrapper for libtextcat. - * [nlp](https://github.com/james-bowman/nlp) - Go Natural Language Processing library supporting LSA (Latent Semantic Analysis). - * [sego](https://github.com/huichen/sego) - Chinese language segmenter. - * [snowball](https://github.com/kljensen/snowball) - Snowball stemmers for multiple languages - * [textcat](https://github.com/pebbe/textcat) - N-gram based text categorization, with support for utf-8 and raw text - -## Logging and Monitoring - - * [colog](https://github.com/comail/colog) - CoLog is a prefix-based leveled execution log for Go - * [cue](https://github.com/bobziuchkovski/cue) - Fast and flexible contextual logger. Supports output to file, syslog, structured syslog, stdout/stderr, socket, Loggly, Honeybadger, Opbeat, Rollbar, and Sentry. - * [epazote](https://github.com/epazote/epazote/) - Automated Microservices Supervisor. - * [factorlog](https://github.com/kdar/factorlog) - Really fast, featureful logging infrastructure (supports colors, verbosity, and many formats) - * [glog](https://github.com/golang/glog) - Leveled execution logs for Go - * [go-logging](https://github.com/op/go-logging) - Supports different logging backends like syslog, file and memory. Multiple backends can be utilized with different log levels per backend and logger. - * [gomol](https://www.github.com/aphistic/gomol) - A multi-output logging library designed for outputs that support additional metadata with log messages. - * [gosrvmon](https://github.com/Alexander-r/gosrvmon) - Self-hosted uptime monitoring system. - * [graylog-golang](https://github.com/robertkowalski/graylog-golang) - graylog-golang is a full implementation for sending messages in GELF (Graylog Extended Log Format) from Google Go (Golang) to Graylog - * [haminer](https://github.com/shuLhan/haminer) - Library and program to parse and forward HAProxy logs - * [immortal](https://immortal.run) - A *nix cross-platform (OS agnostic) supervisor - * [jWalterWeatherman](https://github.com/spf13/jwalterweatherman) - Seamless terminal printing and file logging that s as easy to use as fmt.Println - * [kemba](https://github.com/clok/kemba) - A tiny debug logging tool inspired by [debug](https://github.com/visionmedia/debug), great for CLI tools and applications. - * [log4go](http://log4go.googlecode.com/) - Go logging package akin to log4j - * [logger](https://github.com/weatherglass/pkg/tree/master/logger) - Go logging with buffered output and multiple writers - * [logrus](https://github.com/Sirupsen/logrus) - Structured, pluggable logging for Go with built-in hooks for third-party loggers: Airbrake, Papertrail, Loggly, Sentry... - * [MailJet Live Event Dashboard](https://github.com/arnaudbreton/mailjet-live-event-dashboard) - API monitoring in real time. - * [monkit](https://github.com/spacemonkeygo/monkit) - A flexible process data collection, metrics, monitoring, instrumentation, and tracing library for Go - * [Prometheus](https://github.com/prometheus/prometheus) - Monitoring system and time-series database. - * [rfw](https://github.com/mipearson/rfw) - Rotating file writer - a 'logrotate'-aware file output for use with loggers - * [sd](https://github.com/aletheia7/sd) - Writes to the systemd journal, supports user defined systemd journal fields - * [seelog](https://github.com/cihub/seelog) - Flexible dispatching, filtering, and formatting - * [snap](https://github.com/intelsdi-x/snap) - Telemetry framework - * [spacelog](https://github.com/spacemonkeygo/spacelog) - Hierarchical, leveled, and structured logging library for Go - * [statsgod](https://github.com/acquia/statsgod) - A rewrite of StatsD in Go. - * [syslog](https://github.com/ziutek/syslog) - With this package you can create your own syslog server with your own handlers for different kind of syslog messages - * [Tideland golib](https://github.com/tideland/golib) - Flexible logging - * [timber](https://github.com/ngmoco/timber) - Configurable Logger for Go - * [ul](https://github.com/aletheia7/ul) - Provides macOS Sierra/OSX Unified Loggging functionality via cgo - * [vlog](https://github.com/better0332/vlog) - Leveled log on std log for Go - -## Machine Learning - - * [Anna](https://github.com/xh3b4sd/anna) - Artificial Neural Network Aspiration, aims to be self-learning and self-improving software. - * [bayesian](https://github.com/jbrukh/bayesian) - A naive bayes classifier. - * [ctw](https://github.com/fumin/ctw) - Context Tree Weighting and Rissanen-Langdon Arithmetic Coding - * [Dialex](https://github.com/HyperLab-Solutions-Sdn-Bhd/dialex-sdk-go) - Dialex is a smart pipe that unscrambles text and makes it machine-readable. - * [evo](https://github.com/cbarrick/evo) - a framework for implementing evolutionary algorithms in Go. - * [go-algs/maxflow](https://github.com/daviddengcn/go-algs/tree/master/maxflow) Maxflow (graph-cuts) energy minimization library. - * [go-galib](https://github.com/thoj/go-galib) - Genetic algorithms. - * [golinear](https://github.com/danieldk/golinear) - Linear SVM and logistic regression. - * [go-mind](https://github.com/stevenmiller888/go-mind) - A neural network library built in Go - * [go\_ml](https://github.com/alonsovidales/go_ml) - Linear Regression, Logistic Regression, Neural Networks, Collaborative Filtering, Gaussian Multivariate Distribution. - * [gomlx](https://github.com/gomlx/gomlx) - Accelerated ML and Math Framework for Go (using JIT-compilation with [XLA](https://github.com/openxla/xla)) -- PyTorch/Jax/TensorFlow-like for Go. - * [gonet](https://github.com/dathoangnd/gonet) - Neural Network for Go. - * [go-porterstemmer](https://github.com/reiver/go-porterstemmer) - An efficient native Go clean room implementation of the Porter Stemming algorithm. - * [go-pr](https://github.com/daviddengcn/go-pr) - Gaussian classifier. - * [gorgonia](https://github.com/chewxy/gorgonia) - Neural network primitives library (like Theano or Tensorflow but for Go) - * [mlwebservicego](https://github.com/mrtkp9993/MLWebserviceGo) - Serving machine learning models with Golang, Echo, and Firebase. - * [ntm](https://github.com/fumin/ntm) - [Neural Turing Machines](http://arxiv.org/pdf/1410.5401v2.pdf) implementation - * [openai](https://github.com/andreyvit/openai) — ChatGPT tokenizer and SDK - * [paicehusk](https://github.com/Rookii/paicehusk) - Go implementation of the Paice/Husk Stemmer - * [tfgo](https://github.com/galeone/tfgo) - Tensorflow + Go, the gopher way. - -## Mathematics - - * [bayesian](https://github.com/jbrukh/bayesian) - Naive Bayesian Classification for Go - * [blas](https://github.com/ziutek/blas) - Go implementation of BLAS (Basic Linear Algebra Subprograms) - * [cartconvert](https://github.com/the42/cartconvert) - cartography functions for the Go programming language - * [choose](https://github.com/spakin/choose) - Produce all combinations of *M* out of *N* items - * [clp](https://github.com/lanl/clp) - Go bindings for the COIN-OR Linear Programming (CLP) library - * [Cvx](https://github.com/hrautila/cvx) - Convex optimization package, port of CVXOPT python package - * [decimal](https://github.com/db47h/decimal) - A high-performance arbitrary-precision decimal floating-point arithmetic package - * [dice](https://github.com/tonio-ramirez/dice) - Dice rolling library - * [evaler](https://github.com/soniah/evaler) - A simple floating point arithmetic expression evaluator - * [fixed](https://github.com/klkblake/fixed) - A fixed point (Q32.32 format) math library - * [geom](https://github.com/skelterjohn/geom) - 2d geometry - * [gini](https://github.com/irifrance/gini) - SAT Solver/Boolean Logic Tools - * [gochipmunk](https://github.com/paulcoyle/gochipmunk) - Go bindings to the Chipmunk Physics library - * [gocomplex](http://code.google.com/p/gocomplex/) - a complex number library - * [godec](https://pkg.go.dev/speter.net/go/exp/math/dec/inf) - multi-precision decimal arithmetic - * [gofd](https://bitbucket.org/gofd/gofd) - concurrent finite domain constraint solver. - * [go-fftw](https://github.com/runningwild/go-fftw) - Go bindings for FFTW - The Fastest Fourier Transform in the West - * [go-fn](https://code.google.com/p/go-fn/) - Special functions that would not fit in "math" pkg - * [gographviz](https://github.com/awalterschulze/gographviz) - Graphviz DOT language parser for Go - * [go-gt](https://code.google.com/p/go-gt/) - Graph theory algorithms - * [go-humanize](https://github.com/dustin/go-humanize) - Formatting numbers for humans. - * [golibs/xmath](https://github.com/SimonWaldherr/golibs/tree/master/xmath) - a collection of math functions (mostly mean algorithms) - * [go-lm](https://github.com/awblocker/go-lm) - Linear models in Go. Provides WLS and regression with t residuals via a cgo -> BLAS/LAPACK interface. - * [go.mahalanobis](https://github.com/ant0ine/go.mahalanobis) - Naive implementation of the Mahalanobis distance using go.matrix - * [gomat](http://code.google.com/p/gomat/) - lightweight FAST matrix and vector math - * [go\_matrix\_cuda](https://pkg.go.dev/github.com/alonsovidales/go_matrix_cuda) - GPU-Accelerated Linear Algebra Libraries based in CUDA - * [go.matrix](https://github.com/skelterjohn/go.matrix) - a linear algebra package - * [gonum](https://github.com/gonum) - Scientific packages (linear algebra, BLAS, LAPACK, differentiation, plots, linear programming, statistics, ...) - * [go-symexpr](https://github.com/verdverm/go-symexpr) - Symbolic math as an AST with derivatives, simplification, and non-linear regression - * [gsl](https://bitbucket.org/mingzhi/gsl) - GNU Scientific Library bindings - * [humanize](https://bitbucket.org/dchapes/humanize) - formats large numbers into human readable small numbers - * [interval](https://pkg.go.dev/github.com/cznic/interval) - Package interval handles sets of ordered values laying between two, possibly infinite, bounds. - * [mathutil](https://pkg.go.dev/github.com/cznic/mathutil) - Package mathutil provides utilities supplementing the standard 'math' and 'rand' packages. - * [mt19937\_64](https://github.com/farces/mt19937_64) - Mersenne Twister int64 random source - * [permutation](https://github.com/weatherglass/pkg/tree/master/permutation) - Package permutation generates permutations of the indices of a slice - * [polyclip.go](https://github.com/akavel/polyclip.go) - Go implementation of algorithm for Boolean operations on 2D polygons - * [primegen.go](https://github.com/jbarham/primegen.go) - Sieve of Atkin prime number generator - * [prime](https://github.com/kavehmz/prime) - Go version of Segmented Sieve and non Segmented sieve to produce prime numbers - * [primes](https://github.com/fxtlabs/primes) - Simple functionality for working with prime numbers. - * [pso-go](https://github.com/tenntenn/pso-go) - A library of PSO (Particle Swarm Optimization) for Go. - * [rand](https://bitbucket.org/MaVo159/rand) - 64-bit version of the math/rand package with Mersenne twister support. - * [roger](https://github.com/senseyeio/roger) - A Go client for the RServer, allowing you to invoke R programs from Go. - * [sparse](https://github.com/james-bowman/sparse) - Go Sparse matrix formats for linear algebra supporting scientific and machine learning applications, compatible with [gonum](https://github.com/gonum/gonum/mat) matrix libraries. - * [statistics](https://github.com/grd/stat) - GNU GSL Statistics (GPLv3) - * [stats](https://github.com/montanaflynn/stats) - A statistics package with common functions missing from the Golang standard library. - * [Tideland golib](https://github.com/tideland/golib) - Numerics package for statistcal analysis - * [Units](https://github.com/smyrman/units) - Implements types, units, converter functions and some mathematics for some common physical types. lib - * [vector](https://github.com/proxypoke/vector) - A small vector lib. - -## Microservices - - * [car_registration](https://github.com/infiniteloopltd/GoCarRegistrationAPI) - API wrapper for worldwide car registration data - * [go-doudou](https://github.com/unionj-cloud/go-doudou) - A gossip protocol and OpenAPI 3.0 spec based decentralized microservice framework. Built-in go-doudou cli focusing on low-code and rapid dev can power up your productivity. - * [gokit](https://github.com/go-kit/kit) - The Go Kit microservice framework (and [author interview](http://www.infoq.com/news/2015/09/microservices-with-go-kit)). - * [go-micro](https://github.com/micro/go-micro) - Go Micro is a microservices library which provides the fundamental building blocks for writing fault tolerant distributed systems at scale. - * [kite](https://github.com/koding/kite) - RPC server and client framework. - -## Miscellaneous - - * [atexit](https://bitbucket.org/tebeka/atexit) - Simple atexit library - * [bíogo](https://github.com/biogo/biogo) - Basic bioinformatics functions for the Go language. - * [Breaker](https://github.com/matttproud/golang_circuitbreaker) - Breaker enables graceful degraded mode operations by means of wrapping unreliable interservice interface points with circuit breaker primitives. - * [btcrpcclient](https://github.com/btcsuite/btcrpcclient) - A Websocket-enabled Bitcoin JSON-RPC client. - * [cast](https://github.com/spf13/cast) - Safe and easy casting from one type to another in Go - * [CGRates](https://github.com/cgrates/cgrates) - Rating system designed to be used in telecom carriers world - * [cpu](https://github.com/jpoirier/cpu) - A Go package that reports processor topology - * [cron](https://github.com/robfig/cron) - A library for running jobs (funcs) on a cron-formatted schedule - * [cvt](https://github.com/shockerli/cvt) - Easy and safe convert any value to another type - * [daemonigo](https://github.com/tyranron/daemonigo) - A simple library to daemonize Go applications. - * [dbus-go](http://code.google.com/p/dbus-go/) - D-Bus Go library - * [desktop](https://bitbucket.org/tebeka/desktop) - Open file/uri with default application (cross platform) - * [devboard](https://launchpad.net/devboard) - Kanban board application based on Simple-Khanban - * [dioder-api](https://github.com/piLights/Dioder-API) - An API to IKEA dioder LED-strips - * [doublejump](https://github.com/edwingeng/doublejump) - A revamped Google's jump consistent hash - * [dump](http://code.google.com/p/golang/source/browse/src/pkg/dump/) - An utility that dumps Go variables, similar to PHP's var\_dump - * [elPrep](https://github.com/ExaScience/elprep) - A high-performance tool for preparing sequence alignment/map files in DNA sequencing pipelines - * [env](https://github.com/darkhelmet/env) - Easily pull environment variables with defaults - * [epub](https://gitorious.org/go-pkg/epub) - Bindings for libepub to read epub content. - * [EventBus](https://github.com/asaskevich/EventBus) - Lightweight event bus with async compatibility for Go . - * [faker](https://github.com/manveru/faker) - Generate fake data, names, text, addresses, etc. - * [fasturl](https://github.com/ImVexed/fasturl) - High performance URL parsing library using a Ragel state machine. - * [fsnotify](https://github.com/fsnotify/fsnotify) - File system notifications for Go - * [functional](https://github.com/tcard/functional) - Functional programming library including a lazy list implementation and some of the most usual functions. - * [GCSE](http://go-search.org/) - Go code search engine. [source](https://github.com/daviddengcn/gcse) - * [generate](https://github.com/go-playground/generate) - runs go generate recursively on a specified path or environment variable and can filter by regex. - * [go-amiando](https://github.com/ungerik/go-amiando) - Wrapper for the Amiando event management API - * [go-bit](http://code.google.com/p/go-bit/) - An efficient and comprehensive bitset implementation with utility bit functions. - * [go-bitops](https://github.com/cmchao/go-bitops) - common bit operations for 32/64 bit integer - * [go-business-creditcard](https://github.com/dsparling/go-business-creditcard) - Validate/generate credit card checksums/names. - * [gochem](http://github.com/rmera/gochem) - A computational chemistry/biochemistry library. - * [gocsv](http://code.google.com/p/gocsv) - Library for CSV parsing and emitting - * [go.dbus](https://github.com/guelfey/go.dbus) - Native Go library for D-Bus - * [go-ean](https://github.com/nicholassm/go-ean) - A minimal utility library for validating EAN-8 and EAN-13 and calculating checksums. - * [go-eco](https://code.google.com/p/go-eco/) - Functions for use in ecology - * [go-erx](https://github.com/StepLg/go-erx) - Extended error reporting library - * [go-eventsocket](https://github.com/fiorix/go-eventsocket) - An event socket client/server library for the [FreeSWITCH](https://freeswitch.org) telephony platform. - * [GoFakeIt](https://pkg.go.dev/github.com/brianvoe/gofakeit) - Fake Data Generator. 65+ different variations and examples for each - * [go-fann](https://github.com/white-pony/go-fann) - Go bindings for FANN, library for artificial neural networks - * [GoFlow](https://github.com/trustmaster/goflow) - Flow-based and dataflow programming library for Go - * [goga](https://github.com/rrs/goga) - A genetic algorithm framework - * [gogobject](https://github.com/nsf/gogobject) - GObject-introspection based bindings generator - * [go-idn](http://code.google.com/p/go-idn/) - a project to bring IDN support to Go, feature compatible with libidn - * [GoLCS](https://github.com/makokaka/goalgo/tree/master/algo) - Solve Longest Common Sequence problem in go - * [golibs/as](https://github.com/SimonWaldherr/golibs/tree/master/as) - Converting data types - * [golife](https://github.com/r2p2/golife) - Implementation of Game of Life for command line - * [go-magic](https://code.google.com/p/go-magic/) - A Go wrapper for libmagic - * [go-magic](https://github.com/kwilczynski/go-magic) - Simple interface to libmagic for Go Programming Language - * [go-metrics](https://github.com/rcrowley/go-metrics) - Go port of Coda Hale's Metrics library - * [gommap](https://launchpad.net/gommap) - gommap enables Go programs to directly work with memory mapped files and devices in a very efficient way - * [gomusicbrainz](https://github.com/michiwend/gomusicbrainz) - MusicBrainz WS2 client library - * [goneuro](https://github.com/jbrukh/goneuro) - Go driver for NeuroSky devices. - * [goNI488](https://github.com/jpoirier/goNI488) - A Go wrapper around National Instruments NI488.2 General Purpose Interface Bus (GPIB) driver. - * [go-osx-plist](https://github.com/kballard/go-osx-plist) - CoreFoundation Property List support for Go - * [go-papi](https://github.com/lanl/go-papi) - Go interface to the PAPI performance API - * [go.pcsclite](https://github.com/ebfe/go.pcsclite) - Go wrapper for pcsc-lite - * [Go-PhysicsFS](https://github.com/DeedleFake/Go-PhysicsFS) - Go bindings for the PhysicsFS archive-access abstraction library. - * [go.pipeline](https://github.com/songgao/go.pipeline) - Library that emulates Unix pipelines - * [go-pkg-mpd](https://github.com/jteeuwen/go-pkg-mpd) - A library to access the MPD music daemon - * [go-pkg-xmlx](https://github.com/jteeuwen/go-pkg-xmlx) - Extension to the standard Go XML package. Maintains a node tree that allows forward/backwards browser and exposes some simpel single/multi-node search functions - * [goplan9](http://code.google.com/p/goplan9/) - libraries for interacting with Plan 9 - * [goPromise](https://github.com/anschelsc/goPromise/) - Scheme-like delayed evaluation for Go - * [gopensky](https://github.com/navidys/gopensky/) - Go client for opensky network live's API (airspace ADS-B and Mode S data) - * [go-qrand](https://github.com/salviati/go-qrand) - Go client for quantum random bit generator service at random.irb.hr - * [goraphing](http://code.google.com/p/goraphing/) - A tool to generate a simple graph data structures from JSON data files - * [go-selenium](https://github.com/sourcegraph/go-selenium) - Selenium WebDriver client for Go - * [go-semvar](http://code.google.com/p/go-semver/) - Semantic versions (see http:/semver.org) - * [go-serial](https://github.com/mikepb/go-serial) - Go binding to libserialport for serial port functionality (cgo). - * [goST](https://bitbucket.org/pseudomind/gost) - A steam properties (steam table) library written for Go. This was designed as a native go equivalent to XSteam. - * [go-taskstats](https://github.com/salviati/go-taskstats) - Go interface for Linux taskstats - * [gotenv](https://github.com/subosito/gotenv) - Loads environment variables from `.env` file - * [Gotgo](https://github.com/droundy/gotgo) - A Go preprocessor that provides an implementation of generics - * [go-translate](https://github.com/mattn/go-translate) - Google Language Translate library - * [go-uuid](https://code.google.com/p/go-uuid/) - Universal Unique IDentifier generator and parser - * [gouuid](https://github.com/nu7hatch/gouuid) - Pure Go UUID v3, 4 and 5 generator compatible with RFC4122 - * [go-villa](https://github.com/daviddengcn/go-villa) - Some miscellaneous wrapper and small algorithms.(wrappers to slices, priority queues, path related apis, a string set type) - * [go-wkhtmltopdf](https://github.com/adrg/go-wkhtmltopdf) - wkhtmltopdf Go bindings and high level interface for HTML to PDF conversion. - * [Hranoprovod](https://github.com/aquilax/hranoprovod-go) - Command-line calorie tracking - * [lineup](https://github.com/jdp/lineup) - A minimalistic message queue server - * [mitigation](https://github.com/sarnowski/mitigation) - Package mitigation provides the possibility to prevent damage caused by bugs or exploits. - * [nject](https://github.com/BlueOwlOpenSource/nject) - type safe dependency injection - * [nma.go](https://github.com/dustin/nma.go) - A NotifyMyAndroid client for go. - * [notify](https://github.com/rjeczalik/notify) - File system event notification library with API similar to os/signal. - * [pargo](https://github.com/ExaScience/pargo) - A library for parallel programming in Go. - * [passwd](https://github.com/willdonnelly/passwd) - A parser for the /etc/passwd file - * [pool](https://github.com/stefantalpalaru/pool) - A generic worker pool - * [procfile](https://github.com/hecticjeff/procfile) - A Procfile parser - * [Prometheus Instrumentation/Metrics Client](https://github.com/prometheus/client_golang) - This is a whitebox instrumentation framework for servers written in Go. It exposes programmatically-generated metrics automatically for use in the Prometheus time series collection and post-processing environment. - * [randat](https://github.com/extemporalgenome/randat) - Devel tool for generating random bytestrings and encoding files in code-friendly forms - * [recycler](https://github.com/timtadh/recycler) - A more flexible object recycling system than sync.Pool. Provides constructors and destructors for the objects as well as control over the length the free. - * [replaykit](https://github.com/dustin/replaykit) - A library for replaying time series data. - * [serial](https://github.com/ziutek/serial) - Serial ports API (pure Go) - * [sio](https://github.com/schleibinger/sio) - Package sio lets you access old serial junk. It's a go-gettable fork and modification of dustin's rs232 package. - * [stats](https://github.com/go-playground/stats) - Monitors Go MemStats + System stats such as Memory, Swap and CPU and sends via UDP anywhere you want for logging etc... - * [symutils](https://github.com/salviati/symutils) - Various tools and libraries to handle symbolic links - * [toktok](https://github.com/muesli/toktok) - Creates and resolves unique, typo & error-resilient, human-readable tokens - * [twitterfetcher](https://bitbucket.org/georgebaev/twitterfetcher) - A tool to make Twitter API requests using the [Application-only authentication](https://dev.twitter.com/docs/auth/application-only-auth) - * [udis86](https://github.com/jroimartin/udis86) - Go bindings for libudis86 - * [ugo](https://github.com/alxrm/ugo) - underscore.js like toolbox for Go - * [Vboxgo](https://github.com/th4t/vboxgo) - user-like access to VirtualBox VMs from Go. - * [vk](https://github.com/xelaj/vk) - unofficial vk.com API wrapper (vk.com russian social network) - * [WUID](https://github.com/edwingeng/wuid) - An extremely fast unique number generator, 10-135 times faster than UUID. - * [Wukong](https://github.com/huichen/wukong) - A highly extensible full-text search engine written in Go. - * [xdg](https://github.com/adrg/xdg) - Go implementation of the XDG Base Directory Specification and XDG user directories. - * [xplor](http://bitbucket.org/mpl/xplor) - Files tree browser for p9p acme - * [yubigo](https://github.com/GeertJohan/yubigo) - Yubikey OTP validation and auhtentication API client. - -## Music - - * [gmask](https://github.com/fggp/gmask) - Go adaptation of the Cmask utility for Csound - * [go-csnd6](https://github.com/fggp/go-csnd6) - Go binding to the Csound6 API - * [go-csperfthread](https://github.com/fggp/go-csperfthread) - Go binding to the CsoundPerformanceThread helper class of the Csound6 API - * [go-libshout](https://github.com/systemfreund/go-libshout) - Go bindings for libshout - * [gompd](http://code.google.com/p/gompd/) - A client interface for the MPD (Music Player Daemon) - * [launchpad](https://github.com/rakyll/launchpad) - A Go client for Novation Launchpad - * [portmidi](https://github.com/rakyll/portmidi) - Go bindings for libportmidi - -## Networking - -### DNS - - * [bitz](https://github.com/nictuku/bitz) - BitMessage client node and library - * [dingo](https://github.com/pforemski/dingo) - A DNS client in Go that supports Google DNS over HTTPS - * [dns](https://github.com/benburkert/dns) - client and server implementations in Go - * [dns](https://github.com/miekg/dns) - A DNS library in Go - * [dnsimple](https://github.com/pearkes/dnsimple) - an interface to the DNSimple API - * [dnss](https://github.com/albertito/dnss) - DNS secure proxy, supports DNS over HTTPS and GRPC - * [domainerator](https://github.com/hgfischer/domainerator) - Command line tool to combine wordlist and suffixes/TLDs into domain names and check if they are registered or not. - * [dyndnscd](https://github.com/akrennmair/dyndnscd) - a configurable dyndns client - * [GeoDNS](https://github.com/abh/geodns) - geo-aware authoritative DNS server - * [grong](https://github.com/bortzmeyer/grong) - Small authoritative DNS name server - * [hostsfile](https://github.com/jaytaylor/go-hostsfile) - /etc/hostsfile reverse lookup IP => names - * [lib/dns](https://pkg.go.dev/github.com/shuLhan/share/lib/dns) - The DNS library for client or server with support UDP, TCP, and DNS over HTTPS - * [mdns](https://github.com/davecheney/mdns/) - Multicast DNS library for Go - * [rescached](https://github.com/shuLhan/rescached-go/) - DNS resolver cache daemon - -### FTP - * [ftp4go](http://code.google.com/p/ftp4go/) - An FTP client for Go, started as a port of the standard Python FTP client library - * [ftp](https://bitbucket.org/zombiezen/ftp/) - Package ftp provides a minimal FTP client as defined in RFC 959 - * [ftps](https://github.com/webguerilla/ftps) - An implementation of the FTPS protocol - * [goftp](https://github.com/jlaffaye/ftp) - A FTP client library - -### HTTP - - * [apiproxy](https://sourcegraph.com/github.com/sourcegraph/apiproxy/tree) - proxy for HTTP/REST APIs with configurable cache timeouts - * [boom](https://github.com/rakyll/boom) - HTTP(s) benchmarking tool, Apache Benchmark replacement - * [Ddosify](https://github.com/ddosify/ddosify) - High-performance load testing tool, written in Golang - * [eventsource](https://github.com/antage/eventsource) - Server-sent events for net/http server. - * [fasthttp](https://github.com/valyala/fasthttp) - Fast HTTP package for Go - * [gbench](https://github.com/sasanrose/gbench) - HTTP(s) Load Testing And Benchmarking Tool inspired by Apache Benchmark and Siege. - * [gobench](https://github.com/cmpxchg16/gobench) - HTTP/HTTPS load test and benchmark tool - * [go-curl](https://github.com/andelf/go-curl) - libcurl bingding that supports go func callbacks - * [goproxy](https://github.com/elazarl/goproxy) - a programmable HTTP proxy. - * [gostax](https://github.com/maxymania/gostax) - A Streaming API for XML (StAX) in go - * [handlers](https://github.com/kevinburke/handlers) - Collection of useful HTTP middlewares. - * [HTTPLab](https://github.com/gchaincl/httplab) - HTTPLabs let you inspect HTTP requests and forge responses. - * [httpmock](https://github.com/jarcoal/httpmock) - Easy mocking of HTTP responses from external resources - * [httptail](https://github.com/smallfish/httptail) - tools push stdout/stderr to http chunked - * [sling](https://github.com/dghubble/sling) - A Go HTTP client library for creating and sending API requests. - * [stress](https://github.com/wenjiax/stress) - Replacement of ApacheBench(ab), support for transactional requests, support for command line and package references to HTTP stress testing tool. - -### IMAP - - * [go-imap](https://github.com/emersion/go-imap) - An IMAP library for clients and servers. - * [go-imap](https://github.com/martine/go-imap) - IMAP client library - * [go-imap](https://github.com/mxk/go-imap) - Implementation of IMAP4rev1 client, as described in RFC 3501 - -### Instant Messaging - - * [gobir](http://code.google.com/p/kylelemons/source/browse?repo=gobir) - Extensible IRC bot with channel administration, seen support, and go documentation querying - * [goexmpp](http://code.google.com/p/goexmpp/) - XMPP client implementation - * [goirc](https://github.com/fluffle/goirc/) - event-based stateful IRC client framework - * [go-irc](https://github.com/husio/go-irc) - Simple IRC client library - * [gorobot](https://github.com/aimxhaisse/gorobot) - a modular IRC bot - * [go-xmpp](https://github.com/mattn/go-xmpp) - XMPP client library - * [hanu](https://github.com/sbstjn/hanu) - Framework for writing Slack bots - * [ircflu](https://github.com/muesli/ircflu) - IRC bot with support for commands, scripting and web-hooks - * [irc.go](http://code.google.com/p/go-bot/source/browse/irc.go) - Go IRC bot framework - * [`mellium.im/xmpp`](https://pkg.go.dev/mellium.im/xmpp) a low-level XMPP client and server library focusing on good documentation and a clean, usable API - * [sirius](https://github.com/ortuman/sirius) - [link is broken] A fast and ultra-lightweight chat server written in Go - * [xmpp-client](https://github.com/agl/xmpp-client) - an XMPP client with OTR (off-the-record) support - -### NNTP - - * [go-nntp](https://github.com/dustin/go-nntp) - An NNTP client and server library for go - -### Protocol Buffers - - * [gogoprotobuf](http://code.google.com/p/gogoprotobuf/) - another Go implementation of Protocol Buffers, but with extensions and code generation plugins. - * [golang\_protobuf\_extensions](https://github.com/matttproud/golang_protobuf_extensions) - Protocol Buffer extensions to support streaming message encoding and decoding. - * [goprotobuf](http://code.google.com/p/goprotobuf/) - the Go implementation of Google's Protocol Buffers - * [protorpc](https://github.com/chai2010/protorpc/) - Google Protocol Buffers RPC for Go and C++ - -### rsync - - * [replican-sync](https://github.com/cmars/replican-sync) - An rsync algorithm implementation in Go - * [Rsync](https://github.com/julian-gutierrez-o/rsync) - Rsync algorithm as a Go library - -### Telnet - - * [telnet](https://github.com/reiver/go-telnet) - Package telnet provides TELNET and TELNETS client and server implementations, for the Go programming language, in a style similar to the "net/http" library (that is part of the Go standard library) including support for "middleware"; TELNETS is secure TELNET, with the TELNET protocol over a secured TLS (or SSL) connection. - * [telnet](https://github.com/ziutek/telnet) - A simple interface for interacting with Telnet connection - * [telnets](https://github.com/reiver/telnets) - A client for the TELNETS (secure TELNET) protocol. - -### VNC - - * [glibvnc](https://github.com/LukeMauldin/glibvnc) - Go wrapper using CGO for the libvnc library. - -### Websockets - - * [Gorilla WebSocket](https://github.com/gorilla/websocket) - WebSocket protocol implementation - * [lib/websocket](https://pkg.go.dev/github.com/shuLhan/share/lib/websocket) - A library for writing websocket client and server (using epoll) - * [websocketd](https://github.com/joewalnes/websocketd) - HTTP server that converts STDIN/STDOUT program into WebSockets service. Also handles HTML and CGI. - * [ws-cli](https://github.com/kseo/ws-cli) - WebSocket command line client - * [wst](https://github.com/jthestupidkid/wst) - A dead simple WebSocket tester - -### ZeroMQ - - * [goczmq](https://github.com/zeromq/goczmq) - Wrapper for the CZMQv3 interface - [blog post](http://taotetek.github.io/oldschool.systems/post/goczmq1/) - * [gozmq](https://github.com/alecthomas/gozmq) - Go Bindings for 0mq (zeromq/zmq) - * [zmq2](https://github.com/pebbe/zmq2) - A Go interface to ZeroMQ (zmq, 0MQ) version 2. - * [zmq3](https://github.com/pebbe/zmq3) - A Go interface to ZeroMQ (zmq, 0MQ) version 3. - * [zmq4](https://github.com/pebbe/zmq4) - A Go interface to ZeroMQ (zmq, 0MQ) version 4. - -### Misc Networking - - * [betwixt](https://github.com/zubairhamed/betwixt) - Betwixt implements the OMA Lightweight M2M (LWM2M) protocol for Device Management and Monitoring - * [canopus](https://github.com/zubairhamed/canopus) - CoAP Client/Server implementation (RFC 7252) - * [chunkedreader](https://github.com/knadh/chunkedreader) - A light weight library for reading continuous fixed sized messages from TCP streams. - * [circle](https://github.com/lanl/circle/) - Go interface to the [libcircle](http://hpc.github.io/libcircle/) distributed-queue API - * [createsend-go](https://sourcegraph.com/github.com/sourcegraph/createsend-go/tree) - API client for [Monitor http://www.campaignmonitor.com](wiki/Campaign) (email campaign service) - * [cwmp-proxy](https://github.com/FeNoMeNa/cwmp-proxy) - Reverse cwmp proxy - * [dmrgo](https://github.com/dgryski/dmrgo) - Library for with Hadoop Streaming map/reduce - * [doozerconfig](https://github.com/srid/doozerconfig) - Go package for managing json-encoded configuration in Doozer - * [doozerd](https://github.com/ha/doozerd) - A consistent distributed data store - * [endless](https://github.com/fvbock/endless) Zero downtime restarts for go servers (Drop in replacement for http.ListenAndServe/TLS) - * [gearman-go](https://bitbucket.org/mikespook/gearman-go) - A native implementation for Gearman API with Go. - * [Glue](https://github.com/desertbit/glue) - Robust Go and Javascript Socket Library (Alternative to Socket.io) - * [goagain](https://github.com/rcrowley/goagain) - zero-downtime restarts in Go - * [Go Ajax](https://github.com/jeffreybolle/goajax) - Go Ajax is a JSON-RPC implementation designed to create AJAX powered websites. - * [gobeanstalk](https://github.com/iwanbk/gobeanstalk) - Go Beanstalkd client library - * [go-camo](https://github.com/cactus/go-camo) - Go http image proxy (camo clone) to route images through SSL - * [go-dbus](https://github.com/norisatir/go-dbus) - A library to connect to the D-bus messaging system - * [go-diameter](https://github.com/fiorix/go-diameter) - Diameter stack and Base Protocol (RFC 6733) - * [go-flowrate](https://github.com/mxk/go-flowrate) - Data transfer rate control (monitoring and limiting) - * [gogammu](https://github.com/ziutek/gogammu) - Library for sending and receiving SMS - * [go-icap](http://code.google.com/p/go-icap/) - ICAP (Internet Content Adaptation Protocol) server library - * [Gollum](https://github.com/trivago/gollum) - A n:m multiplexer that gathers messages from different sources and broadcasts them to a set of destinations. - * [go-nat-pmp](http://code.google.com/p/go-nat-pmp/) - A client for the NAT-PMP protocol used in Apple and open-source routers - * [gonetbench](https://github.com/nu7hatch/gonetbench) - Simple TCP benchmarking tool - * [gonetcheck](https://github.com/bjdean/gonetcheck) - package for checking general internet access - * [goodhosts](https://github.com/lextoumbourou/goodhosts) - Simple hosts file (/etc/hosts) management in Go - * [gopacket](http://code.google.com/p/gopacket) - Packet encoding/decoding, pcap/pfring/afpacket support, TCP assembly, and more! - * [gopcap](https://github.com/akrennmair/gopcap) - A simple wrapper around libpcap - * [goq](https://github.com/anandkunal/goq) - A persistent message queue written in Go. - * [goradius](https://github.com/kirves/goradius) - A Radius client written in Go - * [go-rpcgen](https://github.com/kylelemons/go-rpcgen) - ProtoBuf RPC binding generator for net/rpc and AppEngine - * [gorpc](https://github.com/valyala/gorpc) - RPC optimized for high load - * [GoRTP](https://github.com/wernerd/GoRTP) - RTP / RTCP stack implementation for Go - * [GoSIPs](https://github.com/rainliu/gosips) - SIP (Session Initiation Protocol) Stack in Go - * [go-smpp](https://github.com/fiorix/go-smpp) - SMPP 3.4 protocol implementation - * [gosndfile](https://github.com/mkb218/gosndfile) - Go binding for libsndfile - * [gosnmp](https://github.com/soniah/gosnmp) - an SNMP library written in GoLang. - * [go-socket.io](https://github.com/madari/go-socket.io) - A Socket.IO backend implementation written in Go - * [gosocks](https://github.com/hailiang/gosocks) - A SOCKS (SOCKS4, SOCKS4A and SOCKS5) proxy client library in Go. - * [go-sslterminator](https://github.com/cmpxchg16/go-sslterminator) - SSL terminator proxy - * [go-statsd-client](https://github.com/cactus/go-statsd-client) - Go statsd client library - * [Grumble](https://github.com/mkrautz/grumble) - Mumble (VoIP) server implementation - * [handlersocket-go](https://github.com/bketelsen/handlersocket-go) - Go native library to connect to HandlerSocket interface of InnoDB tables - * [HomeControl](https://github.com/brutella/hc) - an implementation of Apple's HomeKit Accessory Protocol (HAP) - * [Hprose](https://github.com/hprose/hprose-go) - Hprose is a High Performance Remote Object Service Engine. - * [httpfstream](https://github.com/sourcegraph/httpfstream) - streaming append and follow of HTTP resources (using WebSockets) - * [humanize-bytes](https://github.com/tv42/humanize-bytes) - Command-line utilities to convert "MiB" etc to raw numbers, and back - * [ipaddress](https://github.com/llimllib/ipaddress) - Convenient ip address functions: ip -> int, int -> ip, and IPNet broadcast address - * [iris-go](https://github.com/karalabe/iris-go) - Go binding for the Iris decentralized messaging framework. - * [iris](http://iris.karalabe.com) - Peer-to-peer messaging for back-end decentralization. - * [kafka.go](https://github.com/jdamick/kafka.go) - Producer & Consumer for the Kafka messaging system - * [lcvpn](https://github.com/kanocz/lcvpn) - Decentralized VPN implementation - * [ldap](https://github.com/mmitton/ldap) - Basic LDAP v3 functionality for the GO programming language. - * [mbxchan](https://bitbucket.org/levarnon/mbx) - An easy communication between distributed Go applications using standard Go channels and remote procedure calls. - * [mqtt](https://github.com/rainliu/mqtt) - MQTT stack in Go - * [nagiosplugin](https://github.com/fractalcat/nagiosplugin) - package for writing Nagios/monitoring plugins - * [NATS](https://github.com/apcera/nats) - NATS distributed messaging system client for Go - * [netsnail](https://github.com/purex01/netsnail) - A low-bandwidth simulator - * [netstat-nat](https://github.com/dominikh/netstat-nat) - Display NAT entries on Linux systems - * [netutils](https://github.com/timtadh/netutils) - Simple interface for turning TCP Sockets into channels. - * [norm](https://github.com/aletheia7/norm) - reliable UDP using multicast and unicast sockets - * [npipe](https://github.com/natefinch/npipe) - a pure Go wrapper for Windows named pipes - * [opendap](https://github.com/mqu/openldap) - Go wrapper for Openldap - * [pusher-http-go](https://github.com/pusher/pusher-http-go) - Go library for interacting with the Pusher Realtime API - * [QRP](https://github.com/liamzebedee/go-qrp) - QRP is a simple packet-based RPC protocol designed as a simple alternative to Go's rpc, that can run over UDP - * [remotize](https://github.com/josvazg/remotize) - A remotize package and command that helps remotizing methods without having to chaneg their signatures for rpc - * [Resgate](https://github.com/jirenius/resgate) - A Realtime + REST API Gateway for NATS to create web APIs with live data - * [rs232](https://github.com/dustin/rs232.go) - Serial interface for those of us who still have modems (or arduinos) - * [rss](https://github.com/SlyMarbo/rss) - RSS parsing library. - * [seamless](https://bitbucket.org/tebeka/seamless) - Reverse TCP Proxy with HTTP management API - * [sftp](https://pkg.go.dev/github.com/shuLhan/share/lib/ssh/sftp) - SSH File Transfer Protocol v3 as defined in draft-ietf-secsh-filexfer-02.txt. - * [shell2http](https://github.com/msoap/shell2http) - Executing shell commands via simple http server - * [sockjs-go](https://github.com/fzzy/sockjs-go) - Implements server side counterpart for the SockJS-client browser library. - * [SOCKS5 Server](https://code.google.com/p/go-socks5) - Scalable SOCKS5 server with Access Control Lists - * [spark](https://github.com/rif/spark) - Emergency web server (for static files) - * [spdy](https://github.com/SlyMarbo/spdy) - SPDY library, wired into net/http, currently supporting servers only. - * [statsd-go](https://github.com/jbuchbinder/statsd-go) - Statsd implementation in Go, forked from gographite, which submits to Ganglia - * [stompngo\_examples](https://github.com/gmallard/stompngo_examples) - Examples for stompngo. - * [stompngo](https://github.com/gmallard/stompngo) - A Stomp 1.1 Compliant Client - * [tcp\_fallback](https://github.com/Memset/tcp_fallback) - A TCP proxy implementing a simple fallback mechanism. - * [tcpmeter](https://github.com/9nut/tcpmeter) - A TCP throughput measuring tool - * [toxiproxy](https://github.com/shopify/toxiproxy) - Framework for simulating network conditions. - * [traceroute](https://github.com/aeden/traceroute) - A traceroute implementation - * [traefik](https://github.com/emilevauge/traefik) - Modern, reverse proxy in Go - * [Uniqush](http://uniqush.org/) - A free and open source software which provides a unified push service for server-side notification to apps on mobile devices. - * [uritemplates](https://github.com/jtacoma/uritemplates) - A level 4 implementation of URI Templates (RFC 6570) - * [VDED](https://github.com/jbuchbinder/vded) - Vector Delta Engine Daemon - track deltas in ever-increasing values (written in Go) - * [zero-downtime-daemon](https://bitbucket.org/PinIdea/zero-downtime-daemon) - Configurable zero downtime daemon (Hot Update) framework for any kind of TCP,HTTP,FCGI services - * [zeroupgrade](https://github.com/thcyron/zeroupgrade) - Upgrades network servers with zero downtime - -## Operating System Interfaces - - * [Go FUSE file system library](http://bazil.org/fuse/) - From-scratch implementation of the kernel-userspace communication protocol based on Russ Cox'. - * [Go-fuse](https://github.com/hanwen/go-fuse) - Library to write FUSE filesystems in Go - * [go-nbd](https://github.com/akmistry/go-nbd) - Library to write block devices for Linux in Go. - * [go-osx-xattr](https://github.com/bitcartel/go-osx-xattr) - Package xattr wraps OS X functions to manipulate the extended attributes of a file, directory and symbolic link. - * [inspect/os](https://github.com/square/inspect) - Metrics library for operating system measurements (Linux/MacOSX) - * [service](https://github.com/kardianos/service) - Service will install / un-install, start / stop, and run a program as a service (daemon) on Windows/Linux and OSX. - -## Option Types - -* [opt](https://github.com/reiver/go-opt) - Package opt implements an optional-type, for the Go programming language. In other programming languages, an optional-type might be know as: a option type, or a maybe type. - -## Other Random Toys, Experiments and Example Code - - * [goconc](http://code.google.com/p/goconc/) - A collection of useful concurrency idioms and functions for Go, compiled - * [go-crazy](https://github.com/droundy/go-crazy) - An experimental source-to-source compiler for go - * [go-gtk-demo](https://github.com/pebbe/go-gtk-demo) - A demonstration of how to use GTK+ with Go. - * [go-hashmap](https://github.com/phf/go-hashmap) - A hash table in pure go as an experiment in Go performance - * [golang-examples](https://github.com/SimonWaldherr/golang-examples) - A bunch of golang examples - * [GolangSortingVisualization](https://github.com/SimonWaldherr/GolangSortingVisualization) - A visualization of various sorting algorithms in Go - * [golibs](https://github.com/SimonWaldherr/golibs) - A collection of tiny go packages (and also a test repo for various CI and coverage services) - * [goplay](https://github.com/timtadh/goplay) - A bunch of random small programs in Go - * [lifegame-on-golang](https://github.com/horiuchi/lifegame-on-golang) - Game of Life in Go - * [linear](https://github.com/tychofreeman/Linear) - Playing around with the linear algebra - * [pl0](http://github.com/cznic/pl0) - PL/0 front end, compiler and VM. . - * [project euler in go](https://github.com/yyyc514/project_euler_in_go) - Solutions to Project Euler in Go also - * [shadergo](https://github.com/gyuque/shadergo) - shader test using Go - * [travisci-golang-example](https://github.com/atotto/travisci-golang-example) - Travis-CI example for Go - -## P2P and File Sharing - - * [DHT](https://github.com/nictuku/dht) - Kademlia DHT node used by Taipei-Torrent, compatible with BitTorrent - * [DHT](https://github.com/shiyanhui/dht) - BitTorrent DHT Protocol && DHT Spider. - * [ed2kcrawler](https://github.com/kevinwatt/ed2kcrawler) - eDonkey2000 link crawler - * [gop2p](https://github.com/nacmartin/gop2p) - A simple p2p app to learn Go - * [go-p2p](https://github.com/tendermint/go-p2p/) - P2P module for blockchains and more - * [GoTella](https://github.com/sourabhdesai/gotella/) - A Go implementation of the Gnutella Protocol - * [Rain](https://github.com/cenkalti/rain) - BitTorrent client and library - * [Taipei-Torrent](https://github.com/jackpal/Taipei-Torrent) - A BitTorrent client - * [Tendermint](https://github.com/tendermint/tendermint) - P2P Byzantine-Fault-Tolerant consensus & blockchain stack - * [wgo](https://github.com/royger/wgo) - A simple BitTorrent client based in part on the Taipei-Torrent and gobit code - -## Programming - - * [go-clang](http://github.com/go-clang) - cgo bindings to the C-API of libclang - * [godeferred](https://github.com/mattn/godeferred) - port of jsdeferred: http://cho45.stfuawsc.com/jsdeferred/ - * [go-galib](https://github.com/thoj/go-galib) - a library of Genetic Algorithms - * [go-intset](https://github.com/phf/go-intset) - a library to work with bounded sets of integers, including multiple alternative implementations - * [go-parse](https://github.com/vito/go-parse) - a Parsec-like parsing library - * [go-slices](https://github.com/merkur0/go-slices) - Helper functions for manipulating slices in Go just like the official "strings" package provides - * [sh](https://github.com/mvdan/sh) - a shell/bash parser and formatter - * [Shuffle](https://github.com/earthboundkid/shuffle) - Implementation of the Fisher Yates shuffle (or Knuth shuffle) in Go. - -## Resource Embedding - - * [fileb0x](https://github.com/UnnoTed/fileb0x) - Simple tool to embed files in go with focus on "customization" and ease to use. - * [go-bindata](https://github.com/jteeuwen/go-bindata) - Package that converts any file into managable Go source code. - * [go-resources](https://github.com/omeid/go-resources) - Unfancy resources embedding with Go. - * [go.rice](https://github.com/GeertJohan/go.rice) - go.rice is a Go package that makes working with resources such as html,js,css,images and templates very easy. - * [implant](https://github.com/skx/implant/) - implant allows embedding static resources, from a series of directories (recursively). - * [statics](https://github.com/go-playground/statics) - Embeds static resources into go files for single binary compilation + works with http.FileSystem + symlinks. - -## RPC - - * [gowsdl](https://github.com/hooklift/gowsdl) - WSDL code generation - * [gRPC](https://grpc.io) - Google's multi-language RPC framework with Go support - -## Scanner and Parser Generators - - * [ebnf2y](http://github.com/cznic/ebnf2y) - Utility for converting EBNF grammars into yacc compatible skeleton .y files. - * [flexgo](https://github.com/pebbe/flexgo) - A version of flex that can produce Go code. - * [fsm](http://github.com/cznic/fsm) - FSM (NFA, DFA) utilities. - * [gocc](http://code.google.com/p/gocc/) - Go Compiler Compiler - * [golex](http://github.com/cznic/golex) - Lex/flex like fast (DFA) scanners generator. - * [gopp](http://github.com/skelterjohn/gopp) - Go Parser Parser - * [goyacc](http://github.com/cznic/goyacc) - Goyacc is a version of yacc generating Go parsers. - * [lexmachine](https://github.com/timtadh/lexmachine) - Lexical Analysis Framework for Golang - * [Ragel](http://www.complang.org/ragel/) - State Machine Compiler - * [y](http://github.com/cznic/y) - Package y converts .y (yacc) source files to data suitable for a parser generator. - * [yy](http://github.com/cznic/yy) - yacc to yacc compiler. - -## Security - - * [acme](https://github.com/hlandau/acme) - ACME certificate acquisition tool - * [acra](https://github.com/cossacklabs/acra) - SQL database protection suite: strong selective encryption, SQL injections prevention, intrusion detection system - * [casbin](https://github.com/hsluoyz/casbin) - An authorization library that supports access control models like MAC, RBAC, ABAC - * [docker-slim](https://github.com/docker-slim/docker-slim) - Container security and optimization - * [gryffin](https://github.com/yahoo/gryffin) - A large scale security scanner by Yahoo! - * [hyperfox](https://github.com/xiam/hyperfox) - a security tool for proxying and recording HTTP and HTTPs communications on a LAN - * [lego](https://github.com/xenolf/lego) - Let's Encrypt client and ACME library - * [webseclab](https://github.com/yahoo/webseclab) - a sample set of web security test cases and a toolkit to construct new ones - -## Simulation Modeling - - * [godes](https://github.com/agoussia/godes) - Library for building discrete event simulation models - -## Sorting - - * [bubble-sort](https://git.darknebu.la/Algorithms/sort/src/branch/master/bubble-sort) - minimal implementation of the [bubble-sort algorithm](https://en.wikipedia.org/wiki/Bubble_sort) - * [cocktail-shaker-sort](https://git.darknebu.la/Algorithms/sort/src/branch/master/cocktail-shaker-sort) - minimal implementation of the [cocktail-shaker-sort algorithm](https://en.wikipedia.org/wiki/Cocktail_shaker_sort) - * [funnelsort](https://github.com/eikeon/funnelsort) - Lazy funnel sort -- a cache-oblivious sorting algorithm - * [Sortutil](http://patrickmylund.com/projects/sortutil/) - Nested, case-insensitive, and reverse sorting for Go. - * [sortutil](https://github.com/cznic/sortutil) - Utilities supplemental to the Go standard "sort" package - * [tarjan](http://github.com/looplab/tarjan) - Graph loop detection function based on Tarjan's algorithm - * [timsort](https://github.com/psilva261/timsort) - Fast, stable sort, uses external comparator or sort.Interface - -## Source Code Management - - * [Gitfile](https://github.com/bradurani/Gitfile) - A lightweight package manager for installing git repos - * [go-deps](https://github.com/sourcegraph/go-deps) - Analyzes and recursively installs Go package deps (library functionality similar to ` go get `) - * [go-diff](https://github.com/daviddengcn/go-diff) - A diff command for go languange showing semantic differences of two go source files. - * [gogitver](https://github.com/aletheia7/gogitver) - Embeds a git tag (version string) into your application - * [go-many-git](https://github.com/abrochard/go-many-git) - Manage and run commands across multiple git repositories - * [go-pkgs](https://github.com/sourcegraph/go-pkgs) - Finds all matching packages in all of the GOPATH trees (library functionality similar to ` go list all `) - * [go-vcs](https://github.com/sourcegraph/go-vcs) - clone and check out revs of VCS repositories (git and hg support) - * [go-vcsurl](https://github.com/sourcegraph/go-vcsurl) - Lenient VCS repository URL parsing library - * [hggofmt](http://bitbucket.org/ede/hggofmt/) - A Mercurial/hg extension with a hook to - * [nut](https://github.com/AlekSi/nut) - Nut is a tool to manage versioned Go source code packages, called "nuts". - * [vcstool](https://github.com/wjwwood/vcstool) - VCS abstraction tool - -## Storage - - * [libStorage](https://github.com/emccode/libstorage) - an open source, platform agnostic, storage provisioning and orchestration framework, model, and API - * [Minio](https://minio.io/) - Object Storage compatible with Amazon S3 API - * [OpenEBS](https://openebs.io) - Containerized, Open source block storage for your containers,integrated tightly into K8S and other environments and based on distributed block storage and containerization of storage control - * [storage](https://github.com/Xuanwo/storage) - An application-oriented unified storage layer for Golang - -## Strings and Text - - * [allot](https://github.com/sbstjn/allot) - Placeholder and wildcard text parsing for CLI tools and bots - * [asciidoctor-go](https://sr.ht/~shulhan/asciidoctor-go/) - Native Go module for parsing and converting asciidoc markup language. - * [awk](https://github.com/spakin/awk) - Easy AWK-style text processing in Go - * [binarydist](https://github.com/kr/binarydist/) - Binary diff and patch - * [Black Friday](https://github.com/russross/blackfriday) - A markdown processor - * [codename-generator](https://github.com/jgautheron/codename-generator) - A codename generator meant for naming software releases - * [columnize](https://code.google.com/p/go-columnize/) - format slice or array into aligned columns - * [csvplus](https://github.com/maxim2266/csvplus) - Extends the standard Go [encoding/csv](https://pkg.go.dev/encoding/csv/) package with fluent interface, lazy stream operations, indices and joins. - * [csvutil](https://github.com/bmatsuo/csvutil) - A heavy duty CSV reading and writing library. - * [dgohash](https://github.com/dgryski/dgohash) - Collection of string hashing functions, including Murmur3 and others - * [douceur](https://github.com/aymerick/douceur) - A simple CSS parser and inliner in Go. - * [dsv](https://github.com/shuLhan/dsv) - A library for working with delimited separated value (DSV). - * [flux](https://github.com/alexanderbartels/flux) - Fluent Regular Expressions in golang - * [frontmatter](https://github.com/adrg/frontmatter) - Go library for detecting and decoding various content front matter formats. - * [genex](https://github.com/alixaxel/genex) - Expansion of Regular Expressions - * [gettext-go](https://github.com/chai2010/gettext-go/) - GNU's gettext support, written in pure Go - * [gettext](https://github.com/gosexy/gettext) - Golang bindings for gettext; Feature complete, cgo - * [goagrep](https://github.com/schollz/goagrep) - fast fuzzy string matching using precomputation - * [go-colortext](https://github.com/daviddengcn/go-colortext) - Change the color of the text and background in the console, working both in Windows and other systems. - * [go-guess](https://github.com/salviati/go-guess) - Go wrapper for libguess - * [goini](https://github.com/glacjay/goini) - A go library to parse INI files - * [golorem](https://github.com/drhodes/golorem) - lorem ipsum generator - * [go-migemo](https://github.com/mattn/go-migemo) - migemo extension for go (Japanese incremental text search) - * [go-ngram](https://github.com/Lazin/go-ngram) N-gram index for Go - * [goregen](https://github.com/zach-klippenstein/goregen) - A Go library for generating random strings from regular expressions. - * [goskirt](https://github.com/madari/goskirt) - Upskirt markdown library bindings for Go - * [gosphinx](https://github.com/kpumuk/gosphinx) - A Go client interface to the Sphinx standalone full-text search engine - * [govalidator](https://github.com/asaskevich/govalidator) - Package of string validators and sanitizers - * [goKMP](https://github.com/paddie/goKMP) - String-matching in Go using the Knuth Morris Pratt algorithm - * [hangul](https://github.com/suapapa/go_hangul) - Handy tools to manipulate Korean character - * [html2text](https://github.com/jaytaylor/html2text) - Golang HTML to text conversion library - * [intern](https://github.com/spakin/intern) - Map strings to symbols for constant-time comparisons - * [kasia.go](https://github.com/ziutek/kasia.go) - Templating system for HTML and other text documents - * [kview](https://github.com/ziutek/kview) - Simple wrapper for kasia.go templates. It helps to modularize content of a website - * [liquid](https://github.com/osteele/liquid) - A complete implementation of Shopify Liquid templates - * [logparse](https://github.com/xojoc/logparse) - Parser for most common log formats - * [NTemplate](https://github.com/yohcop/ntemplate.go) - Nested Templates - * [parse](https://github.com/rymis/parse) - PEG parser that uses reflection to define grammar - * [peg](https://github.com/badgerodon/peg) - Parsing Expression Grammer Parser - * [pigeon](https://github.com/mna/pigeon) - Parsing Expression Grammar (PEG) Parser generator for Go - * [plural](https://github.com/rickb777/plural) - No-fuss plurals for formatting both countable and continuous ranges of values. - * [polyglot](https://github.com/lxn/polyglot) - String translation utilities for Go - * [pretty](https://github.com/kr/pretty) - Pretty-printing for go values - * [raymond](https://github.com/aymerick/raymond) - A complete handlebars implementation in Go. - * [rubex](https://github.com/moovweb/rubex) - A simple regular expression library that supports Ruby's regex syntax. It is faster than Regexp. - * [sanitize](https://github.com/kennygrant/sanitize) - Package sanitize provides functions for sanitizing html and text. - * [scanner](http://code.google.com/p/golang/source/browse/src/pkg/scanner) - A text scanner that parses primitive types, analogous to Java's - * [segment](https://github.com/llimllib/segment) - An implementation of Norvig's recursive word segmentation algorithm - * [sprig](https://github.com/Masterminds/sprig) - Template functions for Go templates. - * [strftime](https://bitbucket.org/tebeka/strftime) - strftime implementation - * [strit](https://github.com/maxim2266/strit) - Package strit introduces a new type of string iterator, as well as a number of iterator constructors, wrappers and combinators. - * [strogonoff](https://github.com/jbochi/strogonoff) - Stenography with Go - * [strutil](https://github.com/adrg/strutil) - Golang metrics for calculating string similarity and other string utility functions. - * [strutil](https://gitlab.com/cznic/strutil) - Package strutil collects utils supplemental to the standard strings package. - * [text](https://github.com/kr/text) - Text paragraph wrapping and formatting - * [Tideland golib](https://github.com/tideland/golib) - Stringex package for statistcal analysis - * [TySug](https://github.com/Dynom/TySug) - Alternative suggestions with respect to keyboard layouts. - * [useragent](https://github.com/xojoc/useragent) - User agent string parser - * [xurls](https://github.com/mvdan/xurls) - Extract urls from text - -## Testing - - * [assert](https://github.com/chai2010/assert) - Assert for go test. - * [assert](https://github.com/golangplus/testing/tree/master/assert) - Handy assert package. - * [assert](https://github.com/go-playground/assert) - Basic Assertion Library used along side native go testing, with building blocks for custom assertions - * [assert](https://github.com/seanpont/assert) - JUnit-like asserts with excellent error messages - * [biff](https://github.com/fulldump/biff) - Bifurcation testing framework, BDD compatible. - * [charlatan](https://github.com/percolate/charlatan) - Tool to generate fake interface implementations for tests. - * [`code.soquee.net/testlog`](https://code.soquee.net/testlog/) A `log.Logger` that proxies to the Log function on a testing.T so that logging only shows up on tests that failed, grouped under the test. - * [conex](https://github.com/omeid/conex) - Docker containers for integration tests - * [counterfeiter](https://github.com/maxbrunsfeld/counterfeiter) - Tool for generating self-contained and type-safe mocks. - * [downtest](https://github.com/jmcvetta/downtest) - Automatically run tests for all known downstream consumers of a Go package. - * [ginkgo](https://github.com/onsi/ginkgo) - BDD Testing Framework for Go. - * [go2xunit](https://bitbucket.org/tebeka/go2xunit) - Convert "go test -v" output to xunit XML output - * [go-assert](http://github.com/daviddengcn/go-assert) - Testing utils for Go. - * [goautotest](https://github.com/ryanslade/goautotest) - Automatically run unit tests when code changes are made - * [goblin](https://github.com/franela/goblin) - Minimal and Beautiful Go testing framework - * [Gocheck](http://labix.org/gocheck) - Rich test framework with suites, fixtures, assertions, good error reporting, etc - * [GoConvey](http://goconvey.co) - Browser-based reporting, uses ` go test `, supports traditional Go tests, clean DSL - * [gocov](https://github.com/axw/gocov) - Code coverage testing/analysis tool - * [gomega](https://github.com/onsi/gomega) - Ginkgo's Preferred Matcher Library. - * [gomock](http://code.google.com/p/gomock/) - a mocking framework for Go. - * [GoSpec](https://github.com/orfjackal/gospec) - a BDD framework - * [gospecify](https://github.com/stesla/gospecify) - another BDD framework - * [go-stat](https://github.com/mreiferson/go-stat) - performant instrumentation/profiling for Go - * [go-tap](https://github.com/Merovius/go-tap) - TAP (Test Anything Protocol) parser in Go - * [go-testdeep](https://github.com/maxatome/go-testdeep) - Extremely flexible deep comparison, extends the testing package - * [go-test-report](https://github.com/vakenbolt/go-test-report) - Captures go test output and parses it into a single self-contained HTML file. - * [gotestsum](https://github.com/gotestyourself/gotestsum) - a test runner with customizable and colored output - * [gotest.tools](https://github.com/gotestyourself/gotest.tools) - a collection of packages for writing readable tests - * [gounit](https://github.com/mdwhatcott/gounit) - xunit for Go - * [GSpec](https://github.com/hailiang/gspec) - _Expressive, reliable, concurrent and extensible_ Go test framework that makes it productive to organize and verify the mind model of software. - * [Gremlins](https://github.com/go-gremlins/gremlins) - A mutation testing tool for Go. - * [httpexpect](https://github.com/gavv/httpexpect) - Concise, declarative, and easy to use end-to-end HTTP and REST API testing - * [make.go.mock](https://github.com/tcard/make.go.mock) - Generates type-safe mocks for Go interfaces and functions. - * [mspec](https://github.com/eduncan911/mspec) - BDD framework that frees you to Stub and Spec your code first with natural BDD language. - * [muxy](https://github.com/mefellows/muxy) - Simulating real-world distributed system failures. - * [Nitro](https://github.com/spf13/nitro) - A quick and simple profiler For Go - * [Pegomock](https://github.com/petergtz/pegomock) - a mocking framework based on [golang/mock](https://github.com/golang/mock), but uses a DSL closely related to [Mockito](http://site.mockito.org/mockito/docs/current/org/mockito/Mockito.html). - * [rapid](https://github.com/flyingmutant/rapid) - property-based testing library with integrated shrinking - * [terst](https://github.com/robertkrimen/terst) - A terse, easy-to-use testing library for Go - * [test2doc](https://code.google.com/p/test2doc/) - Generate documentation for your go units from your unit tests. - * [testfixtures](https://github.com/go-testfixtures/testfixtures) - Rails' like test fixtures for testing database driven apps. - * [testflight](https://github.com/drewolson/testflight) - Painless http testing in Go - * [Testify](https://github.com/stretchrcom/testify) - A set of packages that provide many tools for testifying that your code will behave as you intend. - * [ut](https://github.com/philpearl/ut) - Awesome mocks without magic. - -## Transpiler - - * [c4go](https://github.com/Konstantin8105/c4go) - Transpiling C code to Go code. - * [f4go](https://github.com/Konstantin8105/f4go) - Transpiling Fortran code to Go code. - -## Validation - - * [validator](https://github.com/go-playground/validator) - Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving - * [validation](https://github.com/kdar/validation) - Simple independent struct/key-value validation - -## Version Control - - * [gitea](https://github.com/go-gitea/gitea) - Git with a cup of tea, painless self-hosted git service - * [git (in go)](https://github.com/dskinner/git) - Minimal working git client in Go - * [gogs](http://gogs.io/) - Self-hosting Git Server in Go - * [semver](https://github.com/blang/semver) - Semantic Versioning (SemVer) library - -## Virtual Machines and Languages - - * [agora](https://github.com/PuerkitoBio/agora) - A dynamically typed, garbage collected, embeddable programming language built with Go - * [anko](https://github.com/mattn/anko) - Scriptable interpreter written in golang - * [evalfilter](https://github.com/skx/evalfilter) - Embedded evaluation engine for filtering objects. - * [expr](https://github.com/antonmedv/expr) - Expression evaluator with static typing - * [forego](https://github.com/unixdj/forego) - Forth virtual machine - * [Gelo](http://code.google.com/p/gelo/) - Extensible, embeddable interpreter - * [Gentee](https://github.com/gentee/gentee/) - Embeddable scripting programming language - * [GoAwk](https://github.com/benhoyt/goawk) - An implementation of awk in golang. - * [GoBASIC](https://github.com/skx/gobasic) - An embeddable BASIC interpreter written in golang. - * [GoEmPHP](https://github.com/mikespook/goemphp) - This package is built for Embedding PHP into Go - * [goenv](https://github.com/smyrman/goenv) - Create an isolated environment where you install Go packages, binaries, or even C libraries. Very similar to virtualenv for Python. - * [GoForth](https://github.com/ArtemTitoulenko/GoForth) - A simple Forth parser - * [Goja](https://github.com/dop251/goja) - ECMAScript 5.1(+) implementation written in Go (otto fork with byte code compiler) - * [golem](https://github.com/mjarmy/golem-lang) - A general purpose, interpreted scripting language. - * [golemon](https://github.com/nsf/golemon) - A port of the Lemon parser-generator - * [GoLightly](https://github.com/feyeleanor/GoLightly) - A flexible and lightweight virtual machine with runtime-configurable instruction set - * [goll1e](https://github.com/realistschuckle/goll1e) - An LL(1) parser generator for the Go programming language. - * [Golog](https://github.com/mndrix/golog) - Prolog interpreter in Go - * [golua](https://github.com/aarzilli/golua) - A fork of GoLua that works on current releases of Go - * [go-lua](https://github.com/Shopify/go-lua) - Shopify's lua interpreter - * [gomruby](https://github.com/AlekSi/gomruby) - mruby (mini Ruby) bindings for Go - * [gopher-lua](https://github.com/yuin/gopher-lua) - A Lua 5.1 VM and compiler written in Go - * [go-php](https://github.com/deuill/go-php) - PHP bindings for Go - * [go-python](https://github.com/sbinet/go-python) - go bindings for CPython C-API - * [gotcl](http://code.google.com/p/gotcl/) - Tcl interpreter in Go - * [go-v8](https://github.com/lazytiger/go-v8) - V8 JavaScript engine bindings for Go - * [go.vm](https://github.com/skx/go.vm) - Simple virtual machine which interprets bytecode. - * [Hivemind](https://github.com/DarthSim/hivemind) - Process manager for Procfile-based applications - * [LispEx](https://github.com/kedebug/LispEx) - A dialect of Lisp extended to support for concurrent programming, written in Go. - * [Minima](https://github.com/opesun/minima) - A language implemented in Go - * [ngaro](http://www.anarchyinthetubes.com/hg/go/ngaro) - A ngaro virtual machine to run retroForth images - * [otto](https://github.com/robertkrimen/otto) - A JavaScript parser and interpreter written natively in Go - * [Overmind](https://github.com/DarthSim/overmind) - Process manager for Procfile-based applications and tmux - * [py4go](https://github.com/tliron/py4go) - Python 3 bindings for Go - * [RubyGoLightly](https://github.com/feyeleanor/RubyGoLightly) - An experimental port of TinyRb to Go - * [Scriggo](https://github.com/open2b/scriggo) - A Go interpreter and a template engine with Go as scripting language - * [v8](https://github.com/augustoroman/v8) - V8 JavaScript engine bindings for Go (supports V8 builds at least up to 5.8.244) - * [Yaegi](https://github.com/containous/yaegi) - A complete Go interpreter in Go - -## Web Applications - - * [Caddy](https://caddyserver.com) - A fast, capable, general-purpose HTTP/2 web server that's easy to use - * [Dataflowkit](https://github.com/slotix/dataflowkit) - Web scraping Service to turn websites into structured data. - * [Digestw](https://github.com/mocchira/digestw) - A Web Application - Twitter's Timeline Digest - * [fabio](https://github.com/eBay/fabio) - A fast zero-conf load balancing HTTP router for microservices. - * [Filestash](https://www.filestash.app) - A web client for SFTP, S3, FTP, WebDAV, Git, Minio, LDAP, Caldav, Carddav, Mysql, Backblaze, ... - * [fourohfourfound](https://github.com/whee/fourohfourfound/) - A fallback HTTP server that may redirect requests with runtime configurable redirections - * [Fragmenta](https://github.com/fragmenta/fragmenta-cms) - A CMS built in Go - * [freegeoip](https://github.com/fiorix/freegeoip) - IP geolocation web service (web server of freegeoip.net) - * [Freyr](https://github.com/serdmanczyk/Freyr) - Server for storing and serving readings from plant environment sensors. Integrates Golang API with ReactJS web app; uses Docker for testing/deployment. - * [goals-calendar](https://github.com/nono/goals-calendar) - A web-based Seinfeld calendar implemented in Go - * [goblog](https://github.com/begoon/begoon.github.com) - A static blog engine - * [gocrawl](https://github.com/PuerkitoBio/gocrawl) - A polite, slim and concurrent web crawler. - * [goflash](https://sourceforge.net/p/goflash/home/Home/) - Flash player implementation in Go language - * [gogallery](http://code.google.com/p/gogallery/) - simple web server with an emphasis on easily browsing images - * [gojekyll](https://github.com/osteele/gojekyll) - A golang clone of the Jekyll static site generator - * [goof](https://github.com/stone/goof) - A simple http server to exchange files over http (upload/download) - * [gopages](http://code.google.com/p/gopages/) - A php-like web framework that allows embedding Go code in web pages - * [go\_spider](https://github.com/hu17889/go_spider) - A flexible ,modularization and concurrent web crawler framework. - * [GoURLShortener](https://github.com/NickPresta/GoURLShortener) - A frontend for the http://is.gd/ URL shortener - * [gowall](https://github.com/im7mortal/gowall) - A website and user system - * [grabbit](https://github.com/wework/grabbit) - A lightweight transactional message bus on top of RabbitMQ - * [httpfolder](https://github.com/biorisk/httpfolder) - A http server to exchange files over http with basic authentication (upload/download) - * [Hugo](https://github.com/spf13/hugo) - A fast and flexible static site generator implemented in Go - * [Já Vai Tarde](https://github.com/nictuku/javaitarde) - Unfollows monitoring for Twitter - * [kurz.go](https://github.com/fs111/kurz.go) - a url shortener based on web.go and redis - * [Monsti](https://github.com/chrneumann/monsti) - Resource friendly flat file CMS for private and small business sites. - * [now.go](https://github.com/alloy-d/now.go) - A simple HTTP-based to-do queue. - * [Peach](http://peachdocs.org/) - A web server for multi-language, real-time synced and searchable documentation. - * [Presento](https://github.com/alxrm/presento) - The simplest possible cross-platform remote control for the presentations - * [rabbitmq-http](https://github.com/smallfish/rabbitmq-http) - REST API for RabbitMQ - * [Rickover](https://github.com/Shyp/rickover) - Job queue with a HTTP API, backed by Postgres - * [serve-files](https://github.com/rickb777/servefiles) - Far-future and gzip wrapper around the standard net/http server. - * [sf\_server](http://code.google.com/p/rflk/source/browse/#svn%2Ftrunk%2Fsw%2FGo%2Fsend_file_go) - a tiny send file server and client - * [SuperSaaS API Client](https://github.com/SuperSaaS/supersaas-go-api-client) - HTTP client library for the supersaas.com scheduling/bookings/appointments API - * [Tideland golib](https://github.com/tideland/golib) - Web package for REST request handling - * [Vantaa](https://github.com/nathandao/vantaa) - A modular blogging API engine written in Go, Neo4j and Polymer. - * [websiteskeleton](https://github.com/jadekler/git-go-websiteskeleton) - Simple net/http website skeleton - * [webtf](http://code.google.com/p/webtf/) - Web app to graphical visualization of twitter timelines using the HTML5 - * [Wikifeat](https://github.com/rhinoman/wikifeat) - Extensible wiki system using CouchDB written in Golang - * [jweb](https://gitlab.com/drjele-go/jweb) - A Symfony(https://symfony.com/) inspired framework, written in Go - - -## Web Libraries - -### Authentication - - * [authcookie](https://github.com/dchest/authcookie) - Package authcookie implements creation and verification of signed authentication cookies. - * [`code.soquee.net/otp`](https://code.soquee.net/otp/) A library for generating one-time passwords using HOTP (RFC-4226), and TOTP (RFC-6238). Includes less commonly used profiles, and custom time functions for flexible windows. - * [dgoogauth](https://github.com/dgryski/dgoogauth) - Go port of Google's Authenticator library for one-time passwords - * [goauth](https://github.com/alloy-d/goauth) - A library for header-based OAuth over HTTP or HTTPS. - * [GOAuth](https://github.com/hokapoka/goauth) - OAuth Consumer - * [goha](https://github.com/FeNoMeNa/goha) - Basic and Digest HTTP Authentication for Go http client - * [go-http-auth](https://github.com/abbot/go-http-auth) - HTTP Basic and HTTP Digest authentication - * [Go-OAuth](https://github.com/garyburd/go-oauth) - OAuth 1.0 client - * [go-otp](https://github.com/hgfischer/go-otp) - Package go-otp implements one-time-password generators used in 2-factor authentication systems like RSA-tokens. Currently this supports both HOTP (RFC-4226), TOTP (RFC-6238) and Base32 encoding (RFC-3548) for Google Authenticator compatibility - * [goth](https://github.com/markbates/goth) - Package goth provides a simple, clean, and idiomatic way to write authentication packages for Go web applications - * [hero](https://github.com/gernest/hero) - OAuth server implementation - be an OAuth provider with Go - * [httpauth-go](https://bitbucket.org/rj/httpauth-go) - Package httpauth provides utilities to support HTTP authentication policies. Support for both the basic authentication scheme and the digest authentication scheme are provided. - * [httpauth](https://github.com/apexskier/httpauth) - HTTP session (cookie) based authentication and authorization - * [oauth1a](https://github.com/kurrik/oauth1a) - OAuth 1.0 client library - * [OAuth Consumer](https://github.com/mrjones/oauth) - OAuth 1.0 consumer implementation - * [otp](http://tristanwietsma.github.io/otp/) - HOTP and TOTP library with command line replacement for Google Authenticator - * [securecookie](https://github.com/chmike/securecookie) - Encode and Decode secure cookies - * [totp](https://github.com/balasanjay/totp) - Time-Based One-Time Password Algorithm, specified in RFC 6238, works with Google Authenticator - * [fosite](https://github.com/ory/fosite) - Extensible security first OAuth 2.0 and OpenID Connect SDK for Go. - * [oauth2](https://github.com/go-oauth2/oauth2) - OAuth 2.0 server library for the Go programming language. - * [gin-oauth2](https://github.com/zalando/gin-oauth2) - Middleware for Gin Framework users who also want to use OAuth2 - -### DOM handling - - * [Cascadia](http://code.google.com/p/cascadia) - CSS selector library - * [GoQuery](https://github.com/PuerkitoBio/goquery) - jQuery-like DOM manipulation library, using Go's experimental HTML package. - * [goq](https://github.com/andrewstuart/goq) - jQuery-like declarative struct tag scraping and unmarshaling based on GoQuery. - * [html-query](https://github.com/hailiang/html-query) - A fluent and functional approach to querying HTML. - * [HTML Transform](http://code.google.com/p/go-html-transform/) - A CSS selector based html scraping and transformation library - -### Frameworks and Toolkits - - * [aah](https://aahframework.org) - A scalable, performant, rapid development Web framework for Go. - * [Aero](https://github.com/aerogo/aero) - Fast and secure web server for Go. - * [Air](https://github.com/sheng/air) - An ideal RESTful web framework for Go. - * [alien](https://github.com/gernest/alien) - A lightweight and fast http router - * [app.go](https://github.com/georgenava/appgo) - Web framework for google app engine - * [arasu](https://github.com/arasuresearch/arasu) - A Lightning Fast Web Framework written in Go & Dart - * [Beego](http://beego.me/) - Beego is an open source version of the scalable, non-blocking web framework. - * [browserspeak](https://github.com/xyproto/browserspeak) - Generate HTML templates, CSS or SVG without writing `<` or `>` - * [eudore](https://github.com/eudore/eudore) - Eudore is the core of a golang lightweight web framework. - * [falcore](https://github.com/fitstar/falcore) - Modular HTTP server framework - * [fcgi\_client](https://bitbucket.org/PinIdea/fcgi_client) - Go fastcgi client with fcgi params support - * [Flamingo Framework](https://github.com/i-love-flamingo/flamingo) - Framework for building pluggable production ready web projects. - * [florest](https://github.com/jabong/florest-core) - High-performance workflow based REST API framework in Go - * [forgery](http://goforgery.appspot.com/) - A clone of the superb Node.js web framework Express. - * [Gin Web Framework](https://github.com/gin-gonic/gin) - Martini-like API and httprouter gives it good performance. - * [Goal](https://github.com/colegion/goal) - A toolkit for high productivity web development in Go language built around the concept of code generation. - * [Go-Blog](https://github.com/matt-west/go-blog) - Blog framework written in Go - * [go-fastweb](http://code.google.com/p/go-fastweb/) - aims to be a simple, small and clean MVC framework for go - * [goku](https://github.com/QLeelulu/goku) - a Web Mvc Framework for Go, mostly like ASP.NET MVC. - * [Golanger](https://github.com/golangers/framework) - Golanger Web Framework is a lightweight framework for writing web applications in Go. - * [Goldorak.Go](https://github.com/nono/Goldorak.Go) - a web miniframework built using mustache.go, web.go and Go-Redis - * [go-restful](https://github.com/emicklei/go-restful) - lean package for building REST-style Web Services - * [GoRest](http://code.google.com/p/gorest/) - An extensive configuration(tags) based RESTful style web-services framework. - * [go-rest](https://github.com/ungerik/go-rest) - A small and evil REST framework for Go - * [gorilla](https://github.com/gorilla) - Gorilla web toolkit - * [GoSrv](https://github.com/jcasts/gosrv) - A Go HTTP server that provides simple command line functionality, config loading, request logging, graceful connection shutdown, and daemonization. - * [go-start](https://github.com/ungerik/go-start) - A high level web-framework for Go - * [go-urlshortener](https://github.com/mattn/go-urlshortener) - interface to google's urlshorten API - * [goweb](https://github.com/stretchrcom/goweb) - Lightweight RESTful web framework for Go providing Ruby on Rails style routing - * [go-webproject](http://go-webproject.appspot.com) - Modular web application framework and app server - * [Gowut](http://code.google.com/p/gowut) - Go Web UI Toolkit is a full-featured, easy to use, platform independent Web UI Toolkit written in pure Go. - * [Goyave](https://github.com/System-Glitch/goyave) - An elegant, full-featured web application framework - * [gramework](https://github.com/gramework/gramework) - The *truly* fastest web framework for Go. Battle tested, highly effective baseline for your web apps. - * [httpcoala](https://github.com/goware/httpcoala) - Library for request coalescing - handy for reverse proxies. - * [HttpRouter](https://github.com/julienschmidt/httprouter) - A high performance HTTP request router that scales well - * [limiter](https://github.com/ulule/limiter) - Simple rate limter middleware for Go - * [Macaron](https://github.com/Unknwon/macaron) - Modular web framework in Go - * [mango](https://github.com/paulbellamy/mango) - Mango is a modular web-application framework for Go, inspired by Rack, and PEP333. - * [Martini **deprecated**](https://github.com/codegangsta/martini) - Martini is a popular, lightweight, extensible package for writing modular web apps/services in Go - * [Negroni](https://github.com/codegangsta/negroni) - Idiomatic middleware for Go - * [restclient](https://github.com/jmcvetta/restclient) - Client library for interacting with RESTful APIs. - * [resty](https://github.com/go-resty/resty) - REST client library inspired by Ruby rest-client. - * [Revel](http://robfig.github.com/revel/) - High productivity web framework modeled on Play! Framework - * [Ringo](https://github.com/jjyr/ringo) - Lighweight MVC web framework inspired by Rails, Gin. - * [sawsij](https://bitbucket.org/jaybill/sawsij/src) - Provides a small, opinionated web framework. - * [Tango](https://github.com/lunny/tango) - Micro-kernel & pluggable web framework for Go - * [Tiger Tonic](https://github.com/rcrowley/go-tigertonic) - framework for building JSON web services inspired by Dropwizard - * [trinity](https://github.com/cihub/trinity) - MVC framework - * [uAdmin](https://github.com/uadmin/uadmin) - Web framework with a back end GUI similar to Django. - * [Utron](https://github.com/gernest/utron) - MVC Framework - * [Violetear](https://github.com/nbari/violetear) - HTTP router - * [web.go](https://github.com/hoisie/web) - a simple framework to write webapps - * [wfdr](https://github.com/crazy2be/wfdr) - Simple web framework designed for and written in go. Works with other languages as well, but not as well. - * [xweb](https://github.com/go-xweb/xweb) - A web framework for Go. Just like Struts for Java. - -### HTML forms - - * [form](https://github.com/ajg/form) - Complete bidirectional HTML form encoder & decoder (x-www-form-urlencoded) for arbitrary data (package encoding compatible) - * [gforms](https://github.com/vmihailenco/gforms) - HTML forms for Go - * [Go-FORM-it](https://github.com/kirves/go-form-it) - Go library for easy and highly-customizable forms creation and template rendering. - * [GoForms](https://github.com/absoludity/goforms) - Form data validation, cleaning and error reporting - a la django.forms - * [htmlfiller](https://github.com/griffy/htmlfiller) - Fills in html forms with default values and errors a la Ian Bicking's htmlfill for Python - * [MonstiForm](https://github.com/monsti/form) - HTML form generator and validator library - * [revel-csrf](https://github.com/cbonello/revel-csrf) - Cross-Site Request Forgery (CSRF) attacks prevention for the Revel framework - * [xsrftoken](http://code.google.com/p/xsrftoken) - A package for generating and validating tokens used in preventing XSRF attacks - -### Public API Wrappers - - * [adn](https://github.com/whee/adn/) - Interface to the App.net API - * [anaconda](https://github.com/ChimeraCoder/anaconda) - Client library for the Twitter 1.1 API - * [cloudcomb-go-sdk](https://github.com/bingohuang/cloudcomb-go-sdk) - Go client library for [CloudComb](http://c.163.com) - * [ddg](https://github.com/whee/ddg) - DuckDuckGo API interface - * [facebook](https://github.com/huandu/facebook) - Up-to-date facebook graph API client. Handy and flexible - * [filepicker-go](https://github.com/filepicker/filepicker-go) - Go library for the Filepicker's REST API - * [firebase](https://github.com/cosn/firebase) - Client library for the Firebase REST API - * [gh](https://github.com/rjeczalik/gh) - Scriptable server and net/http middleware for GitHub Webhooks API - * [github](https://github.com/google/go-github) - Go library for accessing the GitHub REST API v3 - * [githubql](https://github.com/shurcooL/githubql) - Go library for accessing the GitHub GraphQL API v4 - * [gobo](https://github.com/huichen/gobo) - Client library for Sina Weibo - * [gocaptcha](https://github.com/GeertJohan/gocaptcha) - gocaptcha provides easy access to the reCaptcha API in go - * [go-dealmap](https://github.com/ancientlore/go-dealmap) - Go library for accessing TheDealMap's API - * [go-dropbox](https://github.com/nickoneill/go-dropbox) - API library for dropbox - * [go-flickr](https://github.com/mncaudill/go-flickr) - A wrapper for Flickr's API - * [go-get-youtube](https://github.com/knadh/go-get-youtube) - A simple library+client for fetching meta data of, and downloading Youtube videos - * [go-gravatar](https://github.com/ungerik/go-gravatar) - Wrapper for the Gravatar API - * [go-hummingbird](https://github.com/nstratos/go-hummingbird) - Go library for accessing the Hummingbird.me API - * [go-libGeoIP](https://github.com/nranchev/go-libGeoIP) - GO Lib GeoIP API for Maxmind - * [gominatim](https://github.com/grindhold/gominatim) - Go library to access nominatim geocoding services - * [gomojo](https://github.com/dotmanish/gomojo) - Instamojo API wrapper - * [gomwapi](https://github.com/kracekumar/go-mwapi) - Access mediawiki contents like wikipedia, wiktionary in golang - * [go-myanimelist](https://github.com/nstratos/go-myanimelist) - Go library for accessing the MyAnimeList API - * [googtrans](https://github.com/bthomson/googtrans) - unofficial go bindings for Google Translate API v2 - * [go-recaptcha](https://github.com/dpapathanasiou/go-recaptcha) - Handles reCaptcha form submissions in Go - * [gorecurly](https://github.com/mbeale/gorecurly) - A Client app to use with Recurly's api - * [go.strava](https://github.com/strava/go.strava) - Official client library for the Strava V3 API - * [go.stripe](https://github.com/bradrydzewski/go.stripe) - a simple credit card processing library for Go using the Stripe API - * [Gotank](https://github.com/searchify/gotank) - Searchify's Go client for the IndexTank full-text search API - * [go-tripit](https://github.com/ancientlore/go-tripit) - Go API library for the TripIt web services - * [GoTwilio](https://github.com/sfreiberg/gotwilio) - Twilio library for Go (golang). Very basic at the moment - * [gravatar](https://github.com/ftrvxmtrx/gravatar) - Gravatar image/profile API library - * [jsonapi](https://github.com/shwoodard/jsonapi) - Generate JSON API from Go structs - * [postmark](https://github.com/gcmurphy/postmark) - Access postmark API from Go - * [reddit.go](https://github.com/tadzik/reddit.go) - Client library for Reddit API - * [shorturl](https://github.com/subosito/shorturl) - Generic implementation for interacting with various URL shortening services - * [SocialSharesCount](https://github.com/gssumesh/socialsharescount) - Wrapper API on multiple social websites to get URL share statistics - * [Stack on Go](https://github.com/laktek/Stack-on-Go) - Go wrapper for Stack Exchange API - * [stripe](https://github.com/stripe/stripe-go) - Official Stripe client library - * [twilio](https://github.com/subosito/twilio) - Simple Twilio API wrapper - * [twittergo](https://github.com/kurrik/twittergo) - Client library for Twitter's API - * [vksdk](https://github.com/SevereCloud/vksdk) - Golang module for working with VK API - -### Other - - * [adhoc-http](https://github.com/tv42/adhoc-httpd) - Quick & dirty HTTP static file server - * [aop](https://github.com/gogap/aop) - Aspect Oriented Programming For Go. - * [assets](https://github.com/mostafah/assets) - Helps prepares CSS and JS files for development and production of Go web apps. - * [bwl](https://github.com/bobappleyard/bwl) - a set of libraries to help build web sites - * [captcha](https://github.com/dchest/captcha) - Image and audio captcha generator and server - * [gaerecords](https://github.com/matryer/gae-records) - Lightweight wrapper around appengine/datastore providing Active Record and DBO style management of data - * [gcd](https://github.com/thepkg/gcd) - provides helpful functions to work with Google Cloud DataStore. - * [get2ch-go](https://github.com/tanaton/get2ch-go) - a library to access the 2channel Japanese web bulletin board - * [gofeed](https://github.com/mmcdole/gofeed) - Parse RSS and Atom feeds in Go - * [go-gzip-file-server](https://github.com/joaodasilva/go-gzip-file-server) - A net.http.Handler similar to FileServer that serves gzipped content - * [gohaml](https://github.com/realistschuckle/gohaml) - An implementation of the popular XHTML Abstraction Markup Language using the Go language. - * [go-httpclient](https://github.com/mreiferson/go-httpclient) - a Go HTTP client with timeouts - * [gojwt](https://github.com/mzgoddard/gojwt) - Json Web Tokens for Go - * [go-pkg-rss](https://github.com/jteeuwen/go-pkg-rss) - a packages that reads RSS and Atom feeds - * [gorefit](http://code.google.com/p/gorefit/) - A library for theming existing websites - * [goreman](https://github.com/mattn/goreman) - foreman clone - * [GoRequest](https://github.com/parnurzeal/gorequest) - Simplified HTTP client with rich features such as proxy, timeout, and etc. ( inspired by nodejs SuperAgent ) - * [goroute](https://github.com/johncylee/goroute) - A very simple URL router based on named submatches of regular expression that works well with http.Handler . - * [gorouter](https://github.com/rsentry/gorouter) - Simple router for go to process url variables - * [go-rss](https://github.com/KonishchevDmitry/go-rss) - Simple RSS parser and generator - * [go-rss](https://github.com/ungerik/go-rss) - Simple RSS parser, tested with Wordpress feeds. - * [goscribble](https://github.com/amir/goscribble) - An MPD Audioscrobble - * [go-twitter](https://github.com/jb55/go-twitter) - another Twitter client - * [go-twitter-oauth](https://github.com/montsamu/go-twitter-oauth) - a simple Twitter client (supports OAuth) - * [grab](https://github.com/cavaliergopher/grab) - A package for managing file downloads - * [grender](https://github.com/peterbourgon/grender) - Go static site generator - * [halgo](https://github.com/jagregory/halgo) - [HAL](http://stateless.co/hal_specification.html)-compliant API client and serialisation library. - * [http-gonsole](https://github.com/mattn/http-gonsole) - Speak HTTP like a local. (the simple, intuitive HTTP console, golang version) - * [httprpc](https://github.com/kdar/httprpc) - HTTP RPC codecs (json2, soap, rest) - * [HypeCMS](https://github.com/opesun/hypecms) - A flexible CMS built with Go and MongoDb. - * [Kontl](https://github.com/geovedi/kontl) - A client for kon.tl's URL shortening service - * [mustache.go](https://github.com/hoisie/mustache.go) - an implementation of the Mustache template language - * [muxer](http://code.google.com/p/go-muxer/) - Simple muxer for a Go app without regexp - * [Optimus Sitemap Generator](http://patrickmylund.com/projects/osg/) - A universal XML sitemap generator - * [passwordreset](https://github.com/dchest/passwordreset) - Creation and verification of secure tokens useful for implementation of "reset forgotten password" feature in web applications. - * [pat](https://github.com/bmizerany/pat) - A Sinatra style pattern muxer - * [persona](https://github.com/areed/persona) - remote verification API for persona - * [plex](https://bitbucket.org/agallego/plex) - simple, small, light, regexp http muxer with chaining - * [podcast](https://github.com/eduncan911/podcast) - iTunes and RSS 2.0 Podcast Generator in Golang - * [purell](https://github.com/PuerkitoBio/purell) - tiny Go library to normalize URLs - * [pusher.go](https://github.com/madari/pusher.go) - HTTP Server Push module for the standard http package - * [rest2go](https://github.com/Kissaki/rest2go) - Based on rest.go, forked for improvements and REST consistency - * [rest.go (forked)](https://github.com/Kissaki/rest.go) - forked rest.go for improvements and REST consistency - * [resty](https://github.com/go-resty/resty) - Simple HTTP and REST client for Go inspired by Ruby rest-client. - * [robotstxt](https://github.com/temoto/robotstxt-go) - The robots.txt exclusion protocol implementation. Allows to parse and query robots.txt file. - * [scs](https://github.com/alexedwards/scs) - A HTTP session manager using server-side sessions stores. - * [seshcookie](https://github.com/bpowers/seshcookie) - A web session library inspired by Beaker - * [soy](https://github.com/robfig/soy) - A Go implementation for Soy templates (Google Closure templates). High performance and i18n. - * [user\_agent](https://github.com/mssola/user_agent) - An HTTP User-Agent parser - * [webtestutil](https://github.com/chlu/webtestutil) - Web and HTTP functional testing utilities. Includes Gorilla testing support. - * [yt2pod](https://github.com/frou/yt2pod) - Daemon that monitors YouTube channels and publishes audio podcasts of them - -## Windows - - * [gform](https://github.com/AllenDang/gform) - An easy to use Windows GUI toolkit for Go - * [go-ole](https://github.com/mattn/go-ole/) - win32 ole implementation for golang - * [go-Windows-begin](https://github.com/yoffset/absolute-Windows---Go-Language-beginner) - for the absolute Windows-Go beginner - * [w32](https://github.com/AllenDang/w32) - Windows API wrapper for Go. - * [walk](https://github.com/lxn/walk) - "Windows Application Library Kit" for the Go Programming Language - * [Windows Command Line Shutdown](http://software-download.name/2012/windows-command-line-shutdown/) - A tool to shutdown Windows Computer from Command Prompt - -## Unix - - * [inspect](https://github.com/square/inspect) - Linux and MacOSX systems monitoring and diagnostics - * [unixsums](https://github.com/cxmcc/unixsums) - Legacy Unix checksums: cksum, sum - -## Unsorted; please help! - -The following entries have not been filed. Please help by putting these in relevant categories. - - * [consistent](https://github.com/buraksezer/consistent) - Consistent hashing with bounded loads. - * [dotviz-server](http://github.com/sc0rp1us/dotviz-server) - WebBased DOT language visualization tool written in go - * [ebml-go](http://code.google.com/p/ebml-go/) - EBML decoder - * [go-bindata](https://github.com/jteeuwen/go-bindata) - Converts any file into manageable Go source code for embedding binary data into a Go program. - * [GoBot](https://github.com/SaturnsVoid/GoBot) - PoC Go HTTP Botnet - * [goconsistenthash](https://github.com/caglar10ur/goconsistenthash) - Consistent hashing library (based on http://www.lexemetech.com/2007/11/consistent-hashing.html) - * [go-cron](https://github.com/rk/go-cron) - A small cron job system to handle scheduled tasks, such as optimizing databases or kicking idle users from chat. The cron.go project was renamed to this for `go get` compatibility. - * [godebiancontrol](https://github.com/mstap/godebiancontrol) - Golang debian control file parser - * [godotviz](http://github.com/sc0rp1us/godotviz) - Rendering graphics files from "DOT language". Written in golang - * [go-gmetric](https://github.com/jbuchbinder/go-gmetric) - Ganglia gmetric protocol support - * [gographviz](http://code.google.com/p/gographviz) - Graphviz DOT language parser for golang - * [gopcapreader](http://code.google.com/p/gopcapreader) - Presents realtime pcap data as io.Reader objects - * [go.psl](https://github.com/ebfe/go.psl) - Go regdom-libs/public suffix list - * [goseq](https://github.com/lmika/goseq) - command line tool, written in Go, for creating sequence diagrams using a text-based description language. - * [go-webfinger](https://github.com/ant0ine/go-webfinger) - Simple Client Implementation of WebFinger - * [img-LinuxFr.org](https://github.com/nono/img-LinuxFr.org) - A reverse-proxy cache for external images used on LinuxFr.org - * [one-file-pdf](https://github.com/balacode/one-file-pdf) - A minimalist Go PDF writer in <2K lines and 1 file - * [seed](https://github.com/tv42/seed) - Easily seed PRNGs with some entropy - * [spellabc](https://github.com/elasticdog/spellabc) - Package spellabc implements spelling alphabet code word encoding. - * [Tasks](https://github.com/thewhitetulip/Tasks) - A simplistic todo list manager written in Go - * [Twackup](https://github.com/tv42/twackup) - Backs up your tweets into local files - * [al-Go-rithms](https://github.com/addy1997/al-Go-rithms) - Collection of algorithms on arrays, runes, strings for reference purpose. diff --git a/Proposals.md b/Proposals.md index ef8ec1c4..d82bbe16 100644 --- a/Proposals.md +++ b/Proposals.md @@ -1 +1,4 @@ -See https://github.com/golang/proposal#readme \ No newline at end of file +The Go wiki on GitHub has moved to go.dev (#61940). + +Try or . + diff --git a/ProviderIntegration.md b/ProviderIntegration.md index c72e52b0..59801dbf 100644 --- a/ProviderIntegration.md +++ b/ProviderIntegration.md @@ -1,22 +1,4 @@ -# Introduction +The Go wiki on GitHub has moved to go.dev (#61940). -A number of Platform-as-a-Service ([PaaS](http://en.wikipedia.org/wiki/Platform_as_a_service)) providers allow you to use Go applications on their clouds. +Try or . -# Details - -| PaaS | Repository | Quickstart Guide | -|:-----|:-----------|:-----------------| -| [Google App Engine](http://developers.google.com/appengine/) | https://github.com/GoogleCloudPlatform/appengine-plus-go | https://developers.google.com/appengine/training/go-plus-appengine/ | -| [Azure](http://www.azure.com/) | https://github.com/wadewegner/azure-website-go-builder | http://www.wadewegner.com/2015/01/creating-a-go-site-extension-and-resource-template-for-azure/ | -| [IBM BlueMix](http://www.ibm.com/bluemix) | | http://www.ibm.com/developerworks/cloud/library/cl-bluemix-go-app/ | -| [CloudBees](http://www.cloudbees.com) | https://github.com/CloudBees-community/golang-clickstart | | -| [Cloud Foundry](http://www.cloudfoundry.com/) | https://github.com/kr/heroku-buildpack-go | http://catdevrandom.me/blog/2013/05/16/buildpacks-in-cloud-foundry-v2/ | -| [dotCloud](http://www.dotcloud.com) | https://github.com/kencochrane/golang-on-dotcloud | | -| [AWS Elastic Beanstalk](https://aws.amazon.com/en/elasticbeanstalk/) | https://github.com/sqs/go-elasticbeanstalk | | -| [Heroku](http://www.heroku.com) | https://github.com/kr/heroku-buildpack-go | http://mmcgrana.github.com/2012/09/getting-started-with-go-on-heroku.html | -| [OpenShift](http://openshift.redhat.com) | https://github.com/gcmurphy/golang-openshift | | -| [Stackato](http://www.activestate.com/stackato) | https://github.com/kr/heroku-buildpack-go | http://docs.stackato.com/user/deploy/languages/go.html | -| [Tsuru](http://www.tsuru.io/) | | http://docs.tsuru.io/en/latest/apps/quickstart/go.html | -| [Cocaine](http://tech.yandex.com/cocaine/) | http://github.com/cocaine https://github.com/3Hren/cocaine-core https://github.com/3Hren/cocaine-plugins https://github.com/cocaine/cocaine-framework-go | https://github.com/cocaine/cocaine-vagrant and https://github.com/3Hren/cocaine-core | -| [GE Predix](https://www.predix.io/) | https://github.com/geaviation/goboot-starter | https://www.predix.io/resources/tutorials/journey.html | -| [Tencent Cloud](https://cloud.tencent.com/) | https://github.com/TencentCloud/tencentcloud-sdk-go | https://intl.cloud.tencent.com/document/product/436/30601| diff --git a/Questions.md b/Questions.md index 381ff7c8..0c72d679 100644 --- a/Questions.md +++ b/Questions.md @@ -1,25 +1,4 @@ -# Asking Questions +The Go wiki on GitHub has moved to go.dev (#61940). -Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and [proposals](https://go.dev/s/proposal-process) only. +Try or . -For asking questions, see: - -* [Stack Overflow](https://stackoverflow.com/questions/tagged/go) with questions tagged "go" or "golang" - -* [The Go Forum](https://forum.golangbridge.org/), a web-based forum - -* [Gophers Discord](https://discord.gg/golang) "Get live support and talk with other gophers on the Go Discord" - -* [Gophers Slack](https://gophers.slack.com), use the [invite app](https://invite.slack.golangbridge.org/) for access. The `#general` channel is a good starting point. - -* [Go Community on Hashnode](https://hashnode.com/n/go) with questions and posts tagged with "go" - -* [The golang-nuts mailing list](https://groups.google.com/d/forum/golang-nuts) - -* [Subreddit for Go](https://www.reddit.com/r/golang/) - -* **IRC** channel #go-nuts on Libera - -If we closed your issue as a question with a link to this wiki, we apologize. Please ask the question on one of the above forums. - -Please do not write your question on a wiki page. Please use one of the above forums. \ No newline at end of file diff --git a/Quiet-Weeks.md b/Quiet-Weeks.md index f21d06e3..9843010c 100644 --- a/Quiet-Weeks.md +++ b/Quiet-Weeks.md @@ -1,13 +1,4 @@ -Periodically throughout the year, the Go team holds “quiet weeks”, with no important conversations happening, to give people time for focus on deep work. +The Go wiki on GitHub has moved to go.dev (#61940). -We aim to do about four single weeks per year, toward the middle of each change window and the middle of each freeze. When we do this, we pre-announce the quiet week on golang-dev@ and post a pinned issue on the issue tracker during the quiet week. +Try or . -Quiet weeks have two goals: - -1. Create time for people to disconnect, take a real break, and recharge, without worrying that they will need to catch up on what they missed when they return. - -2. Create time for people who keep working to do [deep work](https://knowledge.wharton.upenn.edu/article/deep-work-the-secret-to-achieving-peak-productivity/), without all the usual interruptions, including online discussions. - -Quiet weeks can mean vacation. If you're not on vacation, they don't mean not working. Getting work done quietly is great, and we don't want to stop that. We've used an example that if a couple people agree beforehand that the deep work they want to do next week is some kind of collaboration, like meeting to talk through a thorny design doc they are drafting, or pair programming sessions, that's totally fine, as long as that's how they both want to use the week and as long as no one else who would have wanted to be involved will feel like they missed it. - -It's also definitely fine to file most issues and mail most CLs: we don't want everyone to have to queue up a whole bunch of things to send at the end of the quiet week. On the other hand, if you have an issue or a CL that you think might spark a discussion that people will regret having missed or need to catch up on when they return, then we'd appreciate it if you can hold those and wait to post them until the quiet is over. diff --git a/Range.md b/Range.md index 744dc09e..e4bcdc56 100644 --- a/Range.md +++ b/Range.md @@ -1,56 +1,4 @@ -# Range Clauses +The Go wiki on GitHub has moved to go.dev (#61940). -Spec: https://go.dev/ref/spec#For_statements +Try or . -## Summary - -A range clause provides a way to iterate over an array, slice, string, map, or channel. - -## Example - -```go -for k, v := range myMap { - log.Printf("key=%v, value=%v", k, v) -} - -for v := range myChannel { - log.Printf("value=%v", v) -} - -for i, v := range myArray { - log.Printf("array value at [%d]=%v", i, v) -} -``` - -## Reference - -If only one value is used on the left of a range expression, it is the 1st value in this table. - -| Range expression | 1st value | 2nd value (optional) | notes | -|:-----------------|:----------|:---------------------|:------| -| array or slice a ` [n]E `, ` *[n]E `, or ` []E ` | index ` i int ` | ` a[i] ` E | -| string s string type | index ` i int ` | rune ` int ` | range iterates over Unicode code points, not bytes | -| map m ` map[K]V ` | key ` k K ` | value ` m[k] ` V | -| channel c chan E | element ` e E ` | _none_ | - -## Gotchas - -When iterating over a slice or map of values, one might try this: - -```go -items := make([]map[int]int, 10) -for _, item := range items { - item = make(map[int]int, 1) // Oops! item is only a copy of the slice element. - item[1] = 2 // This 'item' will be lost on the next iteration. -} -``` - -The ` make ` and assignment look like they might work, but the value property of ` range ` (stored here as ` item `) is a _copy_ of the value from ` items `, not a pointer to the value in ` items `. The following will work: - -```go -items := make([]map[int]int, 10) -for i := range items { - items[i] = make(map[int]int, 1) - items[i][1] = 2 -} -``` \ No newline at end of file diff --git a/RangefuncExperiment.md b/RangefuncExperiment.md index 69999558..ed5d38cb 100644 --- a/RangefuncExperiment.md +++ b/RangefuncExperiment.md @@ -1,283 +1,4 @@ -For a future Go release, the Go team is considering adding range-over function iterators. -Go 1.22 contains a preliminary implementation of the change, enabled by setting `GOEXPERIMENT=rangefunc` when building your program. We invite anyone who wants to help us understand the effects of the change to try using `GOEXPERIMENT=rangefunc` and let us know about any problems or successes encountered. +The Go wiki on GitHub has moved to go.dev (#61940). -This page answers frequently asked questions about the change. - -### How do I try the change? - -Using Go 1.22, build your program using `GOEXPERIMENT=rangefunc`, as in - - GOEXPERIMENT=rangefunc go install my/program - GOEXPERIMENT=rangefunc go build my/program - GOEXPERIMENT=rangefunc go test my/program - GOEXPERIMENT=rangefunc go test my/program -bench=. - ... - -This will allow import of the experimental package `iter` which exports types - - type Seq[V any] func(yield func(V) bool) - type Seq2[K, V any] func(yield func(K, V) bool) - -and helper functions - - func Pull[V any](seq Seq[V]) (next func() (V, bool), stop func()) - func Pull2[K, V any](seq Seq2[K, V]) (next func() (K, V, bool), stop func()) - -With `GOEXPERIMENT=rangefunc` enabled, loops of the form - - for v := range f { ... } // f has type Seq[V], v has type V - for k, v := range g { ... } // g has type Seq[K,V], k and v have types K and V - -will iterate over the values provided by `f` and `g`, with the usual semantics for break, -continue, return, and other control flow in the loop bodies. If `next(v)` or `next(k,v)` -returns false, the range function should stop iterating and return. -The types for `k` and `v` are inferred in the usual way. - -### What is a simple example of how range over function runs? - -Consider this function for iterating a slice backwards: - - package slices - - func Backward(s []E) func(func(int, E) bool) { - return func(yield func(int, E) bool) { - for i := len(s)-1; i >= 0; i-- { - if !yield(i, s[i]) { - return - } - } - return - } - } - -It can be invoked as: - - s := []string{"hello", "world"} - for i, x := range slices.Backward(s) { - fmt.Println(i, x) - } - -This program would translate inside the compiler to a program more like: - - slices.Backward(s)(func(i int, x string) bool { - fmt.Println(i, x) - return true - }) - -The "return true" at the end of the body is the implicit "continue" at the end of the loop body. An explicit continue would translate to "return true" as well. A break statement would translate to "return false" instead. Other control structures are more complicated but still possible. - -### How is `iter.Pull` used? - -Function iterators are normally "push" iterators where a value generator -(typically a data structure visitor) "pushes" values at a function generated -from the body of the loop. In some cases it is more convenient to "pull" -values from the value generator, and `iter.Pull` accomplishes that. -In this example, `Zip` combines two range functions into a single range -function that provides the respective pairs from the two inputs: - - // Zipped holds values from an iteration of a Seq returned by [Zip]. - type Zipped[T1, T2 any] struct { - V1 T1 - OK1 bool - - V2 T2 - OK2 bool - } - - // Zip returns a new Seq that yields the values of seq1 and seq2 simultaneously. - func Zip[T1, T2 any](seq1 iter.Seq[T1], seq2 iter.Seq[T2]) iter.Seq[Zipped[T1, T2]] { - return func(yield func(Zipped[T1, T2]) bool) { - p1, stop := iter.Pull(seq1) - defer stop() - p2, stop := iter.Pull(seq2) - defer stop() - - for { - var val Zipped[T1, T2] - val.V1, val.OK1 = p1() - val.V2, val.OK2 = p2() - if (!val.OK1 && !val.OK2) || !yield(val) { - return - } - } - } - } - -### What will idiomatic APIs with range functions look like? - -We don't know yet, and that's really part of the eventual standard library proposal. However, you could imagine a container like a binary tree implementing an All method that returns an iterator: - - func (t *Tree[V]) All() iter.Seq[V] - -We would like to establish a name like that, probably All, as the default "all items" iterator. Specific containers might provide others as well. Maybe a list would provide backward iteration too: - - func (l *List[V]) All() iter.Seq[V] - func (l *List[V]) Backward() iter.Seq[V] - -These examples are meant to show that the library can be written in a way that should make these kinds of functions readable and understandable. - -### How are more complicated loops implemented? - -Beyond simple break and continue, other control flow (labeled break, continue, goto out of the loop, return) requires setting a variable that the code outside the loop can consult when the loop breaks. For example a "return" might turn into something like "doReturn = true; return false" where the "return false" is the "break" implementation, and then when the loop finishes, other generated code would do "if(doReturn) return". - -The full rewrite is explained at the top of [cmd/compile/internal/rangefunc/rewrite.go](https://go.googlesource.com/go/+/refs/changes/41/510541/7/src/cmd/compile/internal/rangefunc/rewrite.go) in the implementation. - -### What if the iterator function ignores yield returning false? - -For range-over-function loops, the yield function generated for the body checks if it is called after it has returned false or after loop itself has exited. In either case, it will panic. - -### Why are yield functions limited to at most two arguments? - -There has to be a limit; otherwise people file bugs against the compiler when it rejects ridiculous programs. If we were designing in a vacuum, perhaps we would say it was unlimited but that implementations only had to allow up to 1000, or something like that. - -However, we are not designing in a vacuum: go/ast and go/parser exist, and they can only represent and parse up to two range values. We clearly need to support two values to simulate existing range usages. If it were important to support three or more values, we could change those packages, but there does not appear to be a terribly strong reason to support three or more, so the simplest choice is to stop at two and leave those packages unchanged. If we find a strong reason for more in the future, we can revisit that limit. - -Another reason to stop at two is to have a more limited number of function signatures for general code to define. Standard library changes are explicitly out of scope for this proposal, but having only three signatures means a package can easily define names for all three, like perhaps: - - package iter - - type Seq0 func(yield func() bool) bool - type Seq[V any] func(yield func(V) bool) bool - type Seq2[K, V any] func(yield func(K, V) bool) bool - -### What do stack traces look like in the loop body? - -The loop body is called from the iterator function, which is called from the function in which the loop body appears. The stack trace will show that reality. This will be important for debugging iterators, aligning with stack traces in debuggers, and so on. - -### What happens if the loop body defers a call? Or if the iterator function defers a call? - -If a range-over-func loop body defers a call, it runs when the outer function containing the loop returns, just as it would for any other kind of range loop. That is, the semantics of defer do not depend on what kind of value is being ranged over. It would be quite confusing if they did. That kind of dependence seems unworkable from a design perspective. Some people have proposed disallowing defer in a range-over-func loop body, but this would be a semantic change based on the kind of value being ranged over and seems similarly unworkable. - -The loop body's defer runs exactly when it looks like it would if you didn't know anything special was happening in range-over-func. - -If an iterator function defers a call, the call runs when the iterator function returns. The iterator function returns when it runs out of values or is told to stop by the loop body (because the loop body hit a "break" statement which translated to "return false"). This is exactly what you want for most iterator functions. For example an iterator that returns lines from a file can open the file, defer closing the file, and then yield lines. - -The iterator function's defer runs exactly when it looks like it would if you didn't know the function was being used in a range loop at all. - -This pair of answers can mean the calls run in a different time order than the defer statements executed, and here the goroutine analogy is useful. Think of the main function running in one goroutine and the iterator running in another, sending values over a channel. In that case, the defers can run in a different order than they were created because the iterator returns before the outer function does, even if the outer function loop body defers a call after the iterator does. - -### What happens if the loop body panics? Or if the iterator function panics? - -The deferred calls run in the same order for panic that they would in an ordinary return: first the calls deferred by the iterator, then the calls deferred by the loop body and attached to the outer function. It would be very surprising if ordinary returns and panics ran deferred calls in different orders. - -Again there is an analogy to having the iterator in its own goroutine. If before the loop started the main function deferred a cleanup of the iterator, then a panic in the loop body would run the deferred cleanup call, which would switch over to the iterator, run its deferred calls, and then switch back to continue the panic on the main goroutine. That's the same order the deferred calls run in an ordinary iterator, even without the extra goroutine. - -See [this comment](https://github.com/golang/go/issues/61405#issuecomment-1641050065) for a more detailed rationale for these defer and panic semantics. - -### What happens if the iterator function recovers a panic in the loop body? - -This is an open question that is not yet decided. - -If an iterator recovers a panic from the loop body, the current prototype allows it to invoke yield again and have the loop keep executing. This is a difference from the goroutine analogy. Perhaps it is a mistake, but if so it is a difficult one to correct efficiently. We continue to look into this. - -### Can range over a function perform as well as hand-written loops? - -Yes. Consider the slices.Backward example again, which first translates to: - - slices.Backward(s)(func(i int, x string) bool { - fmt.Println(i, x) - return true - }) - -The compiler can recognize that slices.Backward is trivial and inline it, producing: - - func(yield func(int, E) bool) bool { - for i := len(s)-1; i >= 0; i-- { - if !yield(i, s[i]) { - return false - } - } - return true - }(func(i int, x string) bool { - fmt.Println(i, x) - return true - }) - -Then it can recognize a function literal being immediately called and inline that: - - { - yield := func(i int, x string) bool { - fmt.Println(i, x) - return true - } - for i := len(s)-1; i >= 0; i-- { - if !yield(i, s[i]) { - goto End - } - } - End: - } - -Then it can devirtualize yield: - - { - for i := len(s)-1; i >= 0; i-- { - if !(func(i int, x string) bool { - fmt.Println(i, x) - return true - })(i, s[i]) { - goto End - } - } - End: - } - -Then it can inline that func literal: - - { - for i := len(s)-1; i >= 0; i-- { - var ret bool - { - i := i - x := s[i] - fmt.Println(i, x) - ret = true - } - if !ret { - goto End - } - } - End: - } - -From that point the SSA backend can see through all the unnecessary variables and treats that code the same as - - for i := len(s)-1; i >= 0; i-- { - fmt.Println(i, s[i]) - } - -This looks like a fair amount of work, but it only runs for simple bodies and simple iterators, below the inlining threshold, so the work involved is small. For more complex bodies or iterators, the overhead of the function calls is insignificant. - -### Can you provide more motivation for range over functions? - -The most recent motivation is the addition of generics, which we expect will lead to custom containers such as ordered maps, and it would be good for those custom containers to work well with range loops. - -Another equally good motivation is to provide a better answer for the many functions in the standard library that collect a sequence of results and return the whole thing as a slice. If the results can be generated one at a time, then a representation that allows iterating over them scales better than returning an entire slice. We do not have a standard signature for functions that represent this iteration. Adding support for functions in range would both define a standard signature and provide a real benefit that would encourage its use. - -For example, here are a few functions from the standard library that return slices but probably merit forms that return iterators instead: - - - strings.Split - - strings.Fields - - bytes variants of the above - - regexp.Regexp.FindAll and friends - -There are also functions we were reluctant to provide in slices form that probably deserve to be added in iterator form. For example, there should be a strings.Lines(text) that iterates over the lines in a text. - -Similarly, iteration over lines in a bufio.Reader or bufio.Scanner is possible, but you have to know the pattern, and the pattern is different for those two and tends to be different for each type. Establishing a standard way to express iteration will help converge the many different approaches that exist today. - -For additional motivation for iterators, see #54245. For additional motivation specifically for range over functions, see #56413. - -### Will Go programs using range over functions be readable? - -We think they can be. For example using slices.Backward instead of the explicit count-down loop should be easier to understand, especially for developers who don't see count-down loops every day and have to think carefully through the boundary conditions to make sure they are correct. - -It is true that the possibility of range over a function means that when you see range x, if you don't know what x is, you don't know exactly what code it will run or how efficient it will be. But slice and map iteration are already fairly different as far as the code that runs and how fast it is, not to mention channels. Ordinary function calls have this problem too - in general we have no idea what the called function will do - and yet we find ways to write readable, understandable code, and even to build an intuition for performance. - -The same will certainly happen with range over functions. We will build up useful patterns over time, and people will recognize the most common iterators and know what they do. - -### Why are the semantics not exactly like if the iterator function ran in a coroutine or goroutine? - -Running the iterator in a separate coroutine or goroutine is more expensive and harder to debug than having everything on one stack. Since we're going to have everything on one stack, that fact will change certain visible details. We just saw the first: stack traces show the calling function and the iterator function interleaved, as well as showing the explicit yield function that does not exist on the page in the program. - -It can be helpful to think about running the iterator function in its own coroutine or gorotine as an analogy or mental model, but in some cases the mental model doesn't give the best answer, because it uses two stacks, and the real implementation is defined to use one. +Try or . diff --git a/RateLimiting.md b/RateLimiting.md index 3dedeb71..f271d6f5 100644 --- a/RateLimiting.md +++ b/RateLimiting.md @@ -1,71 +1,4 @@ -# Rate Limiting +The Go wiki on GitHub has moved to go.dev (#61940). -To limit the rate of operations per unit time, use a [time.Ticker](https://pkg.go.dev/time/#NewTicker). -This works well for rates up to tens of operations per second. -For higher rates, prefer a token bucket rate limiter such as [golang.org/x/time/rate.Limiter](https://pkg.go.dev/golang.org/x/time/rate) (also search pkg.go.dev for -[rate limit](http://pkg.go.dev/search?q=rate+limit)). +Try or . -```go -import "time" - -const rateLimit = time.Second / 10 // 10 calls per second - -// Client is an interface that calls something with a payload. -type Client interface { - Call(*Payload) -} - -// Payload is some payload a Client would send in a call. -type Payload struct {} - -// RateLimitCall rate limits client calls with the payloads. -func RateLimitCall(client Client, payloads []*Payload) { - throttle := time.Tick(rateLimit) - - for _, payload := range payloads { - <-throttle // rate limit our client calls - go client.Call(payload) - } -} -``` - -To allow some bursts, add a buffer to the throttle: -```go -import "time" - -const rateLimit = time.Second / 10 // 10 calls per second - -// Client is an interface that calls something with a payload. -type Client interface { - Call(*Payload) -} - -// Payload is some payload a Client would send in a call. -type Payload struct {} - -// BurstRateLimitCall allows burst rate limiting client calls with the -// payloads. -func BurstRateLimitCall(ctx context.Context, client Client, payloads []*Payload, burstLimit int) { - throttle := make(chan time.Time, burstLimit) - - ctx, cancel := context.WithCancel(ctx) - defer cancel() - - go func() { - ticker := time.NewTicker(rateLimit) - defer ticker.Stop() - for t := range ticker.C { - select { - case throttle <- t: - case <-ctx.Done(): - return // exit goroutine when surrounding function returns - } - } - }() - - for _, payload := range payloads { - <-throttle // rate limit our client calls - go client.Call(payload) - } -} -``` diff --git a/ResearchPapers.md b/ResearchPapers.md index 8da0e73e..e7c78ee1 100644 --- a/ResearchPapers.md +++ b/ResearchPapers.md @@ -1,458 +1,4 @@ -This page lists academic and industry research papers about Go or using Go as the implementation language. -## 2021 +The Go wiki on GitHub has moved to go.dev (#61940). -- Gobra: Modular Specification and Verification of Go Programs (F. A. Wolf, L. Arquint, M. Clochard, W. Oortwijn, J. C. Pereira, P. Müller) - - [CAV'21](https://doi.org/10.1007/978-3-030-81685-8_17) - - [web-page](https://gobra.ethz.ch) +Try or . -## 2020 - -- Uncovering the Hidden Dangers: Finding Unsafe Go Code in the Wild (J. Lauinger, L. Baumgärtner, A. Wickert, M. Mezini) - - [arxiv](https://arxiv.org/abs/2010.11242) - - [go-geiger](https://github.com/jlauinger/go-geiger) - - [go-safer](https://github.com/jlauinger/go-safer) - - [Study results](https://github.com/stg-tud/unsafe_go_study_results) - - [Go unsafe.Pointer vulnerability POCs](https://github.com/jlauinger/go-unsafepointer-poc) - - [Conference talk](https://www.youtube.com/watch?v=adn6A7nG61I) -- Lightweight Preemptible Functions (S. Boucher, A. Kalia, D. Andersen, M. Kaminsky) - - [Usenix'20](https://www.usenix.org/conference/atc20/presentation/boucher) -- From Folklore to Fact: Comparing Implementations of Stacks and Continuations (K. Farvadin, J. Reppy) - - [PLDI'20](https://dl.acm.org/doi/abs/10.1145/3385412.3385994) -- Featherweight Go (R. Griesemer, R. Hu, W. Kokke, J. Lange, I. Taylor, B. Toninho, P. Wadler, N. Yoshida) - - [arxiv](https://arxiv.org/abs/2005.11710) -- GoPi: Compiling linear and static channels in Go (M. Giunti) - - [pdf](http://ctp.di.fct.unl.pt/~mgiunti/preprints/coord20_camera.pdf) - - [github](https://github.com/marcogiunti/gopi) -- Fencing off Go: Liveness and Safety for Channel-Based Programming - - [pdf](http://mrg.doc.ic.ac.uk/publications/fencing-off-go-liveness-and-safety-for-channel-based-programming/long.pdf) -- Breaking Type-Safety in Go: An Empirical Study on the Usage of the unsafe Package (D. Costa, S. Mujahid, R. Abdalkareem, E. Shihab) - - [arxiv](https://arxiv.org/abs/2006.09973) -- Static Race Detection and Mutex Safety and Liveness for Go Programs (J. Gabet, N. Yoshida) - - [arxiv](https://arxiv.org/abs/2004.12859) - - [github](https://github.com/JujuYuki/godel2) -- EdgeKV: Decentralized, scalable, and consistent storage for the edge (K. Sonbol, Ö. Özkasap, I. Al-Oqily, M. Aloqaily) - - [arxiv](https://arxiv.org/abs/2006.15594) -- Bypassing memory safety mechanisms through speculative control flow hijacks (A. Mambretti, A. Sandulescu, A. Sorniotti, W. Robertson, E. Kirda, A. Kurmus) - - [arxiv](https://arxiv.org/abs/2003.05503) - - [CL](https://go-review.googlesource.com/c/go/+/222660) -- Bounded verification of message-passing concurrency in Go using Promela and Spin (N. Dilley, J. Lange) - - [arxiv](https://arxiv.org/abs/2004.01323v1) - - [github](https://github.com/nicolasdilley/Gomela) - -## 2019 - -- Software Microbenchmarking in the Cloud. How Bad is it Really?. Laaber, Scheuner, and Leitner. In: Empirical Software Engineering. - - [preprint](http://t.uzh.ch/T4) - - [DOI](http://dx.doi.org/10.1007/s10664-019-09681-1) - - [replication package](https://doi.org/10.6084/m9.figshare.7546703) - -- Understanding Real-World Concurrency Bugs in Go (Tu, Liu, Song, Zhang) - - [ASPLOS'19 preprint](https://songlh.github.io/paper/go-study.pdf) - - [web](https://github.com/system-pclub/go-concurrency-bugs) - -- An empirical study of messaging passing concurrency in Go projects (N. Dilley, J. Lange) - - [SANER'19 pre-print](https://www.cs.kent.ac.uk/people/staff/jl703/papers/dilley-lange-saner19-preprint.pdf) - - [web-page](https://www.cs.kent.ac.uk/people/staff/jl703/go-survey/) - -- A comparison of three programming languages for a full-fledged next-generation sequencing tool (Costanza, Herzeel, Verachtert) - - [biorvix](https://www.biorxiv.org/content/10.1101/558056v1?rss=1) - -- Exploring polyglot software frameworks in ALICE with FairMQ and fer - - [arxiv](https://arxiv.org/abs/1901.04834) - - https://github.com/sbinet-alice/fer - -- Flash: Efficient Dynamic Routing for Offchain Networks - - [arxiv](https://arxiv.org/abs/1902.05260) - -- RepChain: A Reputation based Secure, Fast and High Incentive Blockchain System via Sharding - - [arxiv](https://arxiv.org/abs/1901.05741) - -- Drynx: Decentralized, Secure, Verifiable System for Statistical Queries and Machine Learning on Distributed Datasets - - [arxiv](https://arxiv.org/abs/1902.03785) - -- STYLE-ANALYZER: fixing code style inconsistencies with interpretable unsupervised algorithms - - [arxiv](https://arxiv.org/pdf/1904.00935.pdf) - -- Linear-Time Inference for Pairwise Comparisons with Gaussian-Process Dynamics - - [arxiv](https://arxiv.org/abs/1903.07746) -## 2018 - -- An Evaluation of Open-Source Software Microbenchmark Suites for Continuous Performance Assessment. Laaber and Leitner. In: MSR ’18: 15th International Conference on Mining Software Repositories. - - [preprint](https://www.zora.uzh.ch/id/eprint/159079/1/msr18-author-version.pdf) - - [DOI](https://doi.org/10.1145/3196398.3196407) - - [replication package](https://doi.org/10.6084/m9.figshare.5982253) - -- An Analysis of Quorum-based Abstractions: A Case Study using Gorums to Implement Raft. Sebastian Pedersen, Hein Meling, and Leander Jehl. In: Proceedings of the 2018 Workshop on Advanced Tools, Programming Languages, and PLatforms for Implementing and Evaluating Algorithms for Distributed systems, ApPLIED@PODC 2018, Egham, United Kingdom, July 27, 2018. ACM, 2018. - - [doi:10.1145/3231104.3231957](https://doi.org/10.1145/3231104.3231957) - - [Raft implementation in Gorums](https://github.com/relab/raft) - -- Implementation and evaluation of secure and scalable anomaly-based network intrusion detection (P. Mieden) - - [pdf](https://www.researchgate.net/publication/329815346_Implementation_and_evaluation_of_secure_and_scalable_anomaly-based_network_intrusion_detection?_iepl%5BviewId%5D=l30CNV1Mc1vme3xnwNE1OT0J&_iepl%5Bcontexts%5D%5B0%5D=projectUpdatesLog&_iepl%5BtargetEntityId%5D=PB%3A329815346&_iepl%5BinteractionType%5D=publicationTitle) - - [code](https://github.com/dreadl0ck/netcap) - - [presentation](https://www.researchgate.net/publication/329815099_Bachelor_thesis_Presentation_Implementation_and_evaluation_of_secure_and_scalable_anomaly-based_network_intrusion_detection) - -- ProIO: An Event-Based I/O Stream Format for Protobuf Messages (D. Blyth, J. Alcaraz, S. Binet, S.V. Chekanov) - - [arXiv:1812.03967](https://arxiv.org/abs/1812.03967) - - [proio-org/go-proio](https://pkg.go.dev/github.com/proio-org/go-proio) - -- The latest gossip on BFT consensus (Buchman, Kwon, Milosevic) - - [pdf](https://arxiv.org/abs/1807.04938) - -- Distributed Programming using Role-Parametric Session Types in Go (Castro, Hu, Jongmans, NG, Yoshida) - - [pdf](https://www.doc.ic.ac.uk/research/technicalreports/2018/DTRS18-4.pdf) - -- Observing the Evolution of QUIC Implementations, (Piraux, De Coninck, Bonaventure) - - [pdf](https://arxiv.org/abs/1810.09134) - -- Cody Cutler, M. Frans Kaashoek, and Robert T. Morris, "The benefits and costs of writing a POSIX kernel in a high-level language" - - [presentation](https://www.usenix.org/conference/osdi18/presentation/cutler) - - [code](https://github.com/mit-pdos/biscuit) - -- Voit, Sebastian Peter Johann. "Writing Network Drivers in Go." - - [pdf](https://www.net.in.tum.de/fileadmin/bibtex/publications/theses/2018-ixy-go.pdf) - -- "MoonShine: Optimizing OS Fuzzer Seed Selection with Trace Distillation" (Shankara Pailoor, Andrew Aday, Suman Jana) USENIX Security 2018 - - [pdf](https://www.usenix.org/system/files/conference/usenixsecurity18/sec18-pailoor.pdf) - -- "Process-Local Static Analysis of Synchronous Processes" (Jan Midtgaard, Flemming Nielson, Hanne Riis Nielson) SAS 2018 - - [full version PDF](http://janmidtgaard.dk/papers/Midtgaard-Nielson-Nielson%3aSAS18-full.pdf) - - [prototype](https://github.com/jmid/nano-go) - -- "Inferring and Asserting Distributed System Invariants" (Stewart Grant, Hendrik Cech, Ivan Beschastnikh) ICSE 2018 Technical Papers - - [pdf](https://www.cs.ubc.ca/~bestchai/papers/dinv-icse18.pdf) - - [bitbucket.org/bestchai/dinv/](https://bitbucket.org/bestchai/dinv/) _"DInv is a distributed system data invariant detector"_ ; _"DInv is written in go lang"_ - -- "Revisiting the Vector Space Model: Sparse Weighted Nearest-Neighbor Method for Extreme Multi-Label Classification." (Tatsuhiro Aoshima, Kei Kobayashi, Mihoko Minami) [arXiv:1802.03938](https://arxiv.org/abs/1802.03938) stat.ML, - - [PDF:arXiv:1802.03938-stat.ML](https://arxiv.org/pdf/1802.03938.pdf) - - [github.com/hiro4bbh/sticker ](https://github.com/hiro4bbh/sticker) _"...We have published -our implementation sticker (Aoshima, 2018) written in Golang (Golang, 2009)..."_ - - keywords: sticker, machine-learning, classification - -- A Static Verification Framework for Message Passing in Go using Behavioural Types (J. Lange, N. Ng, B. Toninho, N. Yoshida) - - [accepted draft](http://mrg.doc.ic.ac.uk/publications/a-static-verification-framework-for-message-passing-in-go-using-behavioural-types/draft.pdf) at [ICSE 2018](https://www.icse2018.org/track/icse-2018-Technical-Papers) - - [Tool page](http://mrg.doc.ic.ac.uk/tools/godel-checker/), sources: [godel-checker](https://bitbucket.org/MobilityReadingGroup/godel-checker) and [Go frontend](https://github.com/nickng/gospal) - -- Finding The Greedy, Prodigal, and Suicidal Contracts at Scale (Ivica Nikolic, Aashish Kolluri, Ilya Sergey, Prateek Saxena, Aquinas Hobor) - - [pdf](https://arxiv.org/abs/1802.06038) "To implement the validating framework, we added a new functionality to the official go-ethereum package [20] which allows us to fork the Ethereum main chain at a block height of our choice." - -- State of Mutation Testing at Google (Goran Petrovic and Marko Ivankovic) - - https://research.google.com/pubs/pub46584.html - -- Index Data Structure, Functionality and Microservices in Thematic Virtual Museums (Sajarwo Anggai) (Ph.D. thesis) - - http://vestnik.spbu.ru/html18/s10/s10v1/04.pdf - -- "Two-Phase Dynamic Analysis of Message-Passing Go Programs based on Vector Clocks" (M. Sulzmann, K. Stadtmueller) - - [arxiv](https://arxiv.org/abs/1807.03585) - -- "Revisiting the Vector Space Model: Sparse Weighted Nearest-Neighbor Method for Extreme Multi-Label Classification" (Tatsuhiro Aoshima, Kei Kobayashi, Mihoko Minami) - - [arxiv](https://arxiv.org/abs/1802.03938) - -- "GEEC: Scalable, Efficient, and Consistent Consensus for Blockchains" (Xusheng Chen, Shixiong Zhao, Cheng Wang, Senran Zhang, Heming Cui) - - [arxiv](https://arxiv.org/abs/1808.02252) - -- "Dependability in a Multi-tenant Multi-framework Deep Learning as-a-Service Platform" (Scott Boag, Parijat Dube, Kaoutar El Maghraoui, Benjamin Herta, Waldemar Hummer, K. R. Jayaram, Rania Khalaf, Vinod Muthusamy, Michael Kalantar, Archit Verma) - - [arxiv](https://arxiv.org/abs/1805.06801) - - [github](https://github.com/IBM/FfDL) - -- DRONE: a Distributed Subgraph-Centric Framework for Processing Large Scale Power-law Graphs - - [arxiv](https://arxiv.org/abs/1812.04380) - -- Reducing Metadata Leakage from Encrypted Files and Communication with PURBs - - [arxiv](https://arxiv.org/abs/1806.03160) - - - -## 2017 - -- Gorums: Towards new abstractions for implementing quorum-based systems. Tormod Erevik Lea, Leander Jehl, and Hein Meling. In Kisung Lee and Ling Liu, editors, 37th IEEE International Conference on Distributed Computing Systems, ICDCS 2017, Atlanta, GA, USA, June 5-8, 2017, pages 2380--2385. IEEE Computer Society, 2017 - - [doi:10.1109/ICDCS.2017.166](http://dx.doi.org/10.1109/ICDCS.2017.166) - - [Gorums on GitHub](https://github.com/relab/gorums) -- Go-HEP: writing concurrent software with ease and Go (S. Binet) - - [doi:10.1088/1742-6596/1085/5/052012](https://doi.org/10.1088/1742-6596/1085/5/052012) - - [arXiV:1808.06529](https://arxiv.org/abs/1808.06529) - - https://go-hep.org -- RDFIO: extending Semantic MediaWiki for interoperable biomedical data management (Samuel Lampa, Egon Willighagen, Pekka Kohonen, Ali King, Denny Vrandečić, Roland Grafström, Ola Spjuth) Journal of Biomedical Semantics ( Volume: 8, Issue: 35 ) - - [DOI: 10.1186/s13326-017-0136-y](https://doi.org/10.1186/s13326-017-0136-y) - - The rdf2smw commandline tool, for batch conversion from RDF to Semantic MediaWiki facts in MediaWiki XML dump format, is written in Go - - [github.com/rdfio/rdf2smw](https://github.com/rdfio/rdf2smw) - - [godoc](https://pkg.go.dev/github.com/rdfio/rdf2smw) - - Keywords: Semantic MediaWiki, Semantic Web, RDF -- Construction and first tests of an in-beam PET demonstrator dedicated to the ballistic control of hadrontherapy treatments with 65 MeV protons (E Busato et al.) IEEE Transactions on Radiation and Plasma Medical Sciences ( Volume: PP, Issue: 99 ) - - [DOI: 10.1109/TRPMS.2017.2780447](https://doi.org/10.1109/TRPMS.2017.2780447) - - Monitoring system + parts of the DAQ in Go - - Keywords: Detectors, Particle beams, Protons, Ions, Plasmas, Structural beams, Monitoring -- Let's Go: a Data-Driven Multi-Threading Support (Alberto Scionti,Somnath Mazumdar) CF'17 Proceedings of the Computing Frontiers Conference - - [doi.org/10.1145/3075564.3075596](https://doi.org/10.1145/3075564.3075596) _"... This paper proposes a first attempt to map goroutines on a data-driven based PXM. ..."_ - - Keywords: Data-driven, Programming language, Multi-threading -- Estimating Mixture Entropy with Pairwise Distances (Artemy Kolchinsky, Brendan D. Tracey) - - [arXiv](https://arxiv.org/abs/1706.02419) - - [godoc](https://pkg.go.dev/github.com/btracey/mixent) -- Towards Omnia: a Monitoring Factory for Quality-Aware DevOps (Marco Miglierina, Damian A. Tamburri) - - [doi.org/10.1145/3053600.3053629](https://doi.org/10.1145/3053600.3053629) ICPE '17 Companion - - [github.com/mmiglier/omnia](https://github.com/mmiglier/omnia) (Go: 52.8% ) - - Keywords: Monitoring, Monitoring Management, Monitoring Factory, Monitoring Interface, Monitoring Infrastructure as Code, Monitoring Configuration as Code -- Copy-on-Reference File Mechanism Extends Scope of Dynamic Reconfiguration (Jeremy Krach) thesis - - [pdf](http://honors.cs.umd.edu/uploads/thesis/file/189/Krach_Jeremy_Thesis.pdf) - - [github.com/krockpot/lazyfs](https://github.com/krockpot/lazyfs) _"Lazy file retrieval for process migration."_ -- An event model for phylogenetic biogeography using explicitly geographical ranges (J. Salvador Arias) - - http://onlinelibrary.wiley.com/doi/10.1111/jbi.13024/full - - Computer implementation (EVS written in Go) : [github.com/js-arias/evs](https://github.com/js-arias/evs) _"Evs is a tool for phylogenetic biogeography. -"_ -- Feasibility of reusable continuous thrust spacecraft for cargo resupply missions to Mars (C. B. Rabotin) thesis - - [pdf](http://hanspeterschaub.info/Papers/grads/ChristopherRabotin.pdf) - - [github.com/ChristopherRabotin/smd](https://github.com/ChristopherRabotin/smd) Space Mission Design - A SPICE-enhanced continuous thrust interplanetary mission propagator and vizualizer - - Keywords: space-mission interplanetary-missions celestial-bodies astrodynamics orbit propagation spice -- Performance testing of open-source HTTP web frameworks in an API (Michael A.P. Domingues) DSIE’17 - - https://paginas.fe.up.pt/~prodei/dsie17/DSIE17_Proceedings.pdf#page=18 - - Keywords: Revel, Gin and Echo, Performance testing, API, Web frameworks, Apache benchmark - -- Method of auto-configuration for corporate proxies (Andrés Abelardo Villarroel Acosta, Carlos Enrique Montenegro Marín, Paulo Alonso Gaona García, Yuri Vanessa Nieto Acevedo) Ingeniería solidaria, 2017 - - https://revistas.ucc.edu.co/index.php/in/article/view/1723 - - https://github.com/andresvia/udpac - - Keywords: Proxy Auto-configuration (PAC), Web Proxy Auto-Discovery Protocol (WPAD), Dynamic Host Configuration Protocol (DHCP), Standard Time. -- NucAmino: a nucleotide to amino acid alignment optimized for virus gene sequences ( Philip L. Tzou, Xiaoqiu Huang, Robert W. Shafer ) BMC Bioinformatics (2017) 18: 138. - - [DOI: 10.1186/s12859-017-1555-6](https://link.springer.com/article/10.1186/s12859-017-1555-6) _"... NucAmino is written in the computer language Go ..."_ - - [github.com/hivdb/NucAmino](https://github.com/hivdb/NucAmino) ( Go 94.4% ) - - Keywords: Sequence alignment, Viruses, HIV-1, Drug resistance, Open source -- Idiomatic and Reproducible Software Builds using Containers for Reliable Computing (Jonas Weber) Master’s Thesis - - [arXiv:1702.02999v1 cs.SE 9 Feb 2017](https://arxiv.org/abs/1702.02999), [pdf](https://arxiv.org/pdf/1702.02999.pdf) - - [github.com/thriqon/thesis-supplement](https://github.com/thriqon/thesis-supplement) - -- Structured I/O streams in Clive: a toolbox approach for wide area network computing ( Francisco J. Ballesteros ) - - [DOI: 10.1186/s13174-016-0054-8 OPEN ACCESS](http://jisajournal.springeropen.com/articles/10.1186/s13174-016-0054-8) _" ... Clive is a system written in Go ..."_ - - [Clive related research](http://lsub.org/ls/research.html) - - [Clive source](http://lsub.org/ls/clive.html) _"...Clive is an operating system designed to work in distributed and cloud computing environments. ..."_ - - Keywords: Streams, Input/Output, Operating system, Distributed systems, Cloud computing -- Towards Practical Default-On Multi-Core Record/Replay ( Ali José Mashtizadeh, Tal Garfinkel, David Terei, David Mazières, Mendel Rosenblum) draft , ASPLOS 2017 - - [Draft – Accepted at ASPLOS 2017 - PDF](http://mashtizadeh.org/papers/asplos17-castor-draft.pdf) _"...Castor currently supports applications written in C, C++, and Go on FreeBSD...., ... For Go, we evaluate, Caddy ... "_ -- Comparing MapReduce and Pipeline Implementations for Counting Triangles ( Edelmira Pasarella, Maria-Esther Vidal, Cristina Zoltan) - - [arXiv:1701.03318 cs.DC](https://arxiv.org/abs/1701.03318) - - [pdf](https://arxiv.org/pdf/1701.03318.pdf) _"... an ad-hoc version of MapReduce are implemented in the language Go ..."_ -- Fencing off Go: Liveness and Safety for Channel-based Programming (J. Lange, N. Ng, B. Toninho, N. Yoshida), POPL 2017 - - [doi: 10.1145/3009837.3009847](http://dl.acm.org/citation.cfm?id=3009847) - - [Tool page](http://mrg.doc.ic.ac.uk/tools/gong/), [code](https://github.com/nickng/gong) -- Design and Implementation of Concurrent C0 (Willsey, Prabhu, Pfenning) - - https://arxiv.org/abs/1701.04929 -- Automated Identification of Security Issues from Commit Messages and Bug Reports (Yagin Zhou, Asankhaya Sharma), FSE 2017 - - [doi: 10.1145/3106237.3117771](http://dl.acm.org/citation.cfm?doid=3106237.3117771) -- Reconstructing Program Semantics from Go Binaries (Engelke) - - http://home.in.tum.de/~engelke/pubs/1709-ma.pdf -- An Attempt at Reducing Costs of Disk I/O in Go (Wilson, Mutschlechner) - - http://pages.cs.wisc.edu/~riccardo/assets/diskio.pdf -- Go-RealTime: A Lightweight Framework for Multiprocessor Real-Time System in User Space (Fang, Luo, Anwar, Zhuang, Gupta) - - http://sigbed.seas.upenn.edu/archives/2017-11/paper7.pdf -- "Secure and Trustable Electronic Medical Records Sharing using Blockchain" (Alevtina Dubovitskaya, Zhigang Xu, Samuel Ryu, Michael Schumacher, Fusheng Wang) - - [arxiv](https://arxiv.org/abs/1709.06528) -- "Towards a More Reliable and Available Docker-based Container Cloud" (Mudit Verma, Mohan Dhawan) - - [arxiv](https://arxiv.org/abs/1708.08399) - - -## 2016 -- Atom: Horizontally Scaling Strong Anonymity (Albert Kwon, Henry Corrigan-Gibbs, Srinivas Devadas, Bryan Ford) - - [arXiv:1612.07841 cs.CR](https://arxiv.org/abs/1612.07841) _"...We implemented an Atom prototype in Go in approximately 3,500 lines of code, ..."_ -- The Case for Reconfiguration without Consensus: Comparing Algorithms for Atomic Storage (Leander Jehl, Hein Meling) - - [pdf](http://drops.dagstuhl.de/opus/volltexte/2017/7100/pdf/LIPIcs-OPODIS-2016-31.pdf) - - [github.com/relab/smartmerge](https://github.com/relab/smartmerge) implemented in golang -- Flower : Workflow management and heat-aware scheduling for modern cloud infrastructures (Robert Carosi, -Boris Mattijssen) bachelor thesis, - - [abstract](http://repository.tudelft.nl/islandora/object/uuid:fd1a2aea-84d0-42cc-8043-23a182748f8c), [pdf](http://repository.tudelft.nl/islandora/object/uuid:fd1a2aea-84d0-42cc-8043-23a182748f8c/datastream/OBJ/view), Keywords: container, workflow, virtualization, scheduling, flower, kubernetes -- Implementing a web-based bookingsystem using Go ( Vu, Phi-Long ) Independent thesis Basic level - - [abstract](http://www.diva-portal.org/smash/record.jsf?pid=diva2%3A1070267&dswid=784), [pdf](http://www.diva-portal.org/smash/get/diva2:1070267/FULLTEXT01.pdf) ; Keywords: Booking System, Go, Golang, REST, XSS, XSRF -- Parallelization of the corpus manager’s time-consuming operations (Bc. Radoslav Rábara ) Master's Thesis, Masaryk University - - [pdf](http://www.itspy.cz/wp-content/uploads/2016/11/IT_SPY_2016_paper_60.pdf) ; Keywords: Manatee, text corpora, Go, text compression, compression of integers, time-consuming operations, parallelization, MapReduce, Glow, distributed computing, data format, cluster, scalability -- Cyber Security Exercise Modeling & Tracking (Joonas Greis) Bachelor’s thesis - - [pdf](https://www.theseus.fi/bitstream/handle/10024/120054/Thesis_rellu.pdf) _"... RESTful API was written with Golang using Go-Json-Rest package ..."_ -- Scalable Byzantine Consensus via Hardware-assisted Secret Sharing (Jian Liu, Wenting Li, Ghassan O. Karame, N. Asokan) - - [arXiv:1612.04997 cs.CR](https://arxiv.org/abs/1612.04997) ; _"... Our implementation is based on Golang ..."_ ; [pdf](https://arxiv.org/pdf/1612.04997v1.pdf) -- Fast and Reliable Byzantine Fault Tolerance (Eric Scott Freeman) Master's thesis in Computer science - - [link](http://hdl.handle.net/11250/2413908), [pdf]( https://brage.bibsys.no/xmlui/bitstream/handle/11250/2413908/Freeman_Eric.pdf?sequence=1) -- Formal verification of concurrency in go (Anuchit Prasertsang, Denduang Pradubsuwun) - - [DOI: 10.1109/JCSSE.2016.7748882](http://dx.doi.org/10.1109/JCSSE.2016.7748882) -- Therapeutic target discovery using Boolean network attractors: updates from kali ( Arnaud Poret ) ( Quantitative Biology > Molecular Networks) - - [arXiv:1611.03144v1 q-bio.MN](https://arxiv.org/abs/1611.03144v1) - - [github.com/arnaudporet/kali](https://github.com/arnaudporet/kali) [Go 100.0%] -- Information Flow Analysis for Go ( Eric Bodden, Ka I. Pun, Martin Steffen, Volker Stolz, Anna-Katharina Wickert) - - [10.1007/978-3-319-47166-2_30](http://link.springer.com/chapter/10.1007/978-3-319-47166-2_30) -- A Productivity Checker for Logic Programming (E. Komendantskaya, P. Johann, M. Schmidt ) - - [arXiv:1608.04415 cs.PL](https://arxiv.org/abs/1608.04415) - - project page: http://www.macs.hw.ac.uk/~ek19/CoALP/ -- A novel algorithm for detecting multiple covariance and clustering of biological sequences -( Wei Shen & Yan Li) ( Coevolution, Computational models ) - - http://www.nature.com/articles/srep30425 , doi:10.1038/srep30425 - - Algorithm implementation (golang - only binary ) : http://yanlilab.github.io/fastcov/ -- Architecture of the Hyperledger Blockchain Fabric (Christian Cachin) - - [pdf](https://www.zurich.ibm.com/dccl/papers/cachin_dccl.pdf) - - [code]( https://github.com/hyperledger/fabric/) -- Reimagining the Programming Experience ( Mehrdad Afshari , dissertation) GoClr - - [pdf](https://mehrdad.afshari.me/publications/dissertation.pdf) -- MapReduce vs. Pipelining Counting Triangles (Edelmira Pasarella, Maria-Esther Vidal,and Cristina Zoltan) - - [pdf](http://ceur-ws.org/Vol-1644/paper33.pdf) -- Parametric Polymorphism in the Go Programming Language (Matthew Allen) University of Texas, -Turing Scholars honors thesis - - [pdf](http://apps.cs.utexas.edu/tech_reports/reports/tr/TR-2231.pdf) - - [code](https://github.com/Matt343/llgo) ( LLGO based ) -- Static Trace-Based Deadlock Analysis for Synchronous Mini-Go ( Kai Stadtmüller, Martin Sulzmann, and Peter Thiemann ) - - [pdf](http://www.home.hs-karlsruhe.de/~suma0002/publications/TraceBasedDeadlockAnalysisMiniGo.pdf) - - [code](https://github.com/KaiSta/gopherlyzer) - first beta implementation : gopherlyzer -- Continuous Query-Based Syndication: Distributed, Expressive Messaging for the IoT( Gabriel Fierro, Erik Krogen ) - - [pdf](https://people.eecs.berkeley.edu/~kubitron/courses/cs262a-S16/projects/reports/project1_report.pdf), [motivation](https://github.com/gtfierro/cs262-project/blob/master/Motivation.md) - - [code](https://github.com/gtfierro/cs262-project) ( Go and Python implementation ) -- Privacy, Discovery, and Authentication for the Internet of Things (Wu, Taly, Shankar, Boneh) - - [arxiv](https://arxiv.org/abs/1604.06959) - - [code](https://vanadium.github.io/) -- Static Deadlock Detection for Concurrent Go by Global Session Graph Synthesis (Ng, Yoshida) - - [pdf](http://www.doc.ic.ac.uk/~cn06/pub/2016/dingo/main.pdf) - - [code](https://github.com/nickng/dingo-hunter) -- A Small-Step Semantics of a Concurrent Calculus with Goroutines and Deferred Functions ( Martin Steffen ) - - [springer link](http://link.springer.com/chapter/10.1007%2F978-3-319-30734-3_26) -- Butterfield, Ellis H., "Fog Computing with Go: A Comparative Study" (2016). CMC Senior Theses. Paper 1348. - - http://scholarship.claremont.edu/cmc_theses/1348 -- An Implementation and Analysis of a Kernel Network Stack in Go with the CSP Style (Harshal Sheth, Aashish Welling) - - [arXiv:1603.05636 cs.OS](http://arxiv.org/abs/1603.05636 ) -- PAS-MC: Privacy-preserving Analytics Stream for the Mobile Cloud (Joy, Gerla) - - [arXiv:1604.04892 cs.CR](https://arxiv.org/abs/1604.04892) -- Developing an Ethereum Blockchain Application (Triantafyllidis) - - [pdf](https://homepages.staff.os3.nl/~delaat/rp/2015-2016/p53/report.pdf) -- Identifying and characterizing Sybils in the Tor network (Winter, Ensafi, Loesing, and Feamster) - - [pdf](https://nymity.ch/sybilhunting/pdf/sybilhunting.pdf) - - [code](https://github.com/NullHypothesis/sybilhunter) -- A Distributed Implementation of the Graph Database System: DGraph - - [pdf](https://www.dropbox.com/s/7h4ytak39r2pdun/Ashwin_Thesis.pdf?dl=0) -- Browsix: Bridging the Gap Between Unix and the Browser (Powers, Vilk, Berger) - - https://arxiv.org/abs/1611.07862 -- Verification of Goroutines using Why3 (Schoolderman) - - https://www.ru.nl/publish/pages/769526/marc_schoolderman.pdf -- Detection of Bugs and Code Smells through Static Analysis of Go Source Code (Bergersen) - - https://www.duo.uio.no/bitstream/handle/10852/53050/bergersen_msc.pdf -- BTrDB: Optimizing Storage System Design for Timeseries Processing (Andersen, Culler) - - https://www.usenix.org/node/194399 -- Risk Factor Disclosures: Do Managers and Markets Speak the Same Language? - - https://www.sec.gov/comments/s7-06-16/s70616-369.pdf - -## 2015 -- Tinzenite: Encrypted Peer to Peer File Synchronization via the Tox Protocol (Tamino P.S.M. Hartmann) (Master thesis at Ulm University) - - [pdf](http://dbis.eprints.uni-ulm.de/1334/1/ma_final_hartmann.pdf) - - [github.com/tinzenite](https://github.com/tinzenite) -- Blade: A Data Center Garbage Collector (Terei, Levy) - - [arxiv:1504.02578 cs.DC](https://arxiv.org/abs/1504.02578) -- Flywheel: Google's Data Compression Proxy for the Mobile Web (Agababov, Buettner, Chudnovsky, Cogan, Greenstein, McDaniel, Piatek, Scott, Welsh, Yin) - - [pdf](http://research.google.com/pubs/pub43447.html) - - [Rewriting a large production system in Go](http://matt-welsh.blogspot.com/2013/08/rewriting-large-production-system-in-go.html) -- A Machine Learning Strategy to Assist Turbulence Model Development (Brendan Tracey, Karthik Duraisamy, Juan J. Alonso) - - http://arc.aiaa.org/doi/abs/10.2514/6.2015-1287 -- Implementing an intelligent version of the classical sliding-puzzle game for unix terminals using Golang's concurrency primitives ( Pravendra Singh ) - - [arxiv:1503.08345 cs.AI](http://arxiv.org/abs/1503.08345 ) -- Keeping Authorities "Honest or Bust" with Decentralized Witness Cosigning (Syta, Tamas, Visher, Wolinsky, Jovanovic, Gasser, Gailly, Khoffi, Ford) - - [arxiv:1503.08768 cs.CR](https://arxiv.org/abs/1503.08768) - - [code](https://github.com/dedis/cothority), [code](https://github.com/dedis/cosi) -- Message Passing for Programming Languages and Operating Systems (Martynas Pumputis ) Master’s Thesis - - [pdf](http://e-collection.library.ethz.ch/eserv/eth:48404/eth-48404-01.pdf) -- Type inference for Go (Emin Gigovic, Philip Malmros ) - - [pdf](http://fileadmin.cs.lth.se/cs/Education/EDAN70/CompilerProjects/2015/Reports/GigovicMalmros.pdf) -- Open-Source, Platform-Independent Library and Online Scripting Environment for Accessing Thermo Scientific RAW Files. (Kelchtermans, Silva, Argentini, Staes, Vandenbussche, Laukens, Valkenborg, Martens) - - https://www.ncbi.nlm.nih.gov/pubmed/26477298 -- Evaluation of performance and productivity metrics of potential programming languages in the HPC environment ( Bachelor Thesis ; Florian Wilkens ) - ( Go, Rust, C, OpenStreetMap ) - - [github-code](https://github.com/MrFloya/thesis-ba) , [pdf](https://github.com/MrFloya/thesis-ba/raw/master/tex/thesis.pdf) -- Concurrent Processing of Text Corpus Queries (Rábara, Rychlý) - - https://www.sketchengine.co.uk/wp-content/uploads/Concurrent_Processing_2015.pdf -- Automatic Memory Management Techniques for the Go Programming Language (Davis) (Ph.D. thesis) - - https://minerva-access.unimelb.edu.au/handle/11343/58707 -- Design Muntoi Web-based Framework and Search Engine Analytics for Thematic Virtual Museums (Sajarwo Anggai) (Ph.D. thesis) - - http://ieeexplore.ieee.org/document/7516334/ -- A Search Engine Backed by Internet-Wide Scanning (Durumeric, Adrian, Mirian, Bailey, Halderman) - - https://censys.io/static/censys.pdf -- An Extract Function Refactoring for the Go Language (Arasu) - - https://etd.auburn.edu/bitstream/handle/10415/4835/Steffi_Gnanaprakasa_MSThesis.pdf -- Compositional Decompilation using LLVM IR (BSc thesis, Robin Eklind) - - http://uu.diva-portal.org/smash/record.jsf?pid=diva2%3A911797&dswid=-6147 - - [code](https://github.com/decomp/decomp) - - [pdf](https://github.com/decomp/doc/raw/master/report/compositional_decompilation/compositional_decompilation.pdf) -- "U-root: A Go-based, Firmware Embeddable Root File System with On-demand Compilation" (Minnich, Mirtchovski) - - [pdf](https://www.usenix.org/system/files/conference/atc15/atc15-paper-minnich.pdf) - - [code](https://github.com/u-root/u-root) -## 2014 -- PARAGON: an approach for parallelization of power system contingency analysis using Go programming language - - http://onlinelibrary.wiley.com/doi/10.1002/etep.1999/full -- A Study of Successive Over-relaxation Method Parallelization Over Modern HPC Languages (Mittal) - - [arxiv:1401.0763 cs.DC](https://arxiv.org/abs/1401.0763) - - [code](https://github.com/sparsh0mittal/sor_serial_parallel_codes) -- There Is More Consensus in Egalitarian Parliaments (Moraru, Andersen, Kaminsky) - - [pdf](https://www.cs.cmu.edu/~dga/papers/epaxos-sosp2013.pdf) - - [code](https://github.com/efficient/epaxos) - - [Experience with ePaxos: Systems Research using Go](https://da-data.blogspot.com/2013/10/experience-with-epaxos-systems-research.html) -- Research Problems of Implementing Go - - https://talks.golang.org/2014/research.slide (rsc) - - https://talks.golang.org/2014/research2.slide (dvyukov) -- bíogo: a simple high-performance bioinformatics toolkit for the Go language (D. Kortschak, D. Adelson) - - [pdf](http://biorxiv.org/content/early/2014/05/12/005033) -- P2S: A Fault-Tolerant Publish/Subscribe Infrastructure (Chang, Duan, Meling, Peisert, Zhang) - - [pdf](http://cs.unc.edu/~haibin/p2s.pdf) -- Generating a Google Go framework from an Uppaal model (Dekker) - - [pdf](https://www.cs.ru.nl/bachelorscripties/2014/Jip_Dekker___4122100___Generating_Google_Go_framework_from_Uppaal_models.pdf) -- Using the Go Programming Language in Practice (Westrup, Pettersson) - - [pdf](https://www.researchgate.net/publication/312490994_Using_the_Go_Programming_Language_in_Practice) -- A Language Support for Exhaustive Fault-Injection in Message-Passing System Models (Suzuki, Watanabe) - - [arXiv:1411.3793 cs.SE](https://arxiv.org/abs/1411.3793) -- Big Learning with Bayesian Methods - - [arXiv:1411.6370 cs.LG](https://arxiv.org/abs/1411.6370) -- Be General and Don't Give Up Consistency in Geo-Replicated Transactional Systems - - [PDF](http://hyflow.org/pubs/opodis14-alvin.pdf) - - Project page: [Hyflow](http://www.hyflow.org/hyflow-go/index.html) -- The design and verification of Mumax3 (Vansteenkiste, Leliaert, Dvornik, Garcia-Sanchez, Van Waeyenberge) - - https://arxiv.org/abs/1406.7635 - - https://github.com/mumax/3 -- Building Reliable and Practical Byzantine Fault Tolerance (Duan) - - http://sduan.informationsystems.umbc.edu/files/2014-SisiDuan-dissertation.pdf - -## 2013 -- GoPar: Automatic Loop Parallelization of Go Programs (Wetherbee) - - [pdf](https://docs.google.com/file/d/0B6tFaBl5qV_gNmpRTnJkcEo4a2M/edit) - - [code](https://github.com/wetherbeei/gopar) -- SCTP in Go ( Olivier Van Acker ) - - Keywords: Stream Control Transmission Protocol (SCTP); Transmission Control Protocol (TCP); Go; Networking; - - [pdf](https://2013.asiabsdcon.org/papers/abc2013-P7A-paper.pdf) -- Benchmarking Usability and Performance of Multicore Languages ( Sebastian Nanz, Scott West, Kaue Soares da Silveira, Bertrand Meyer) - - [arXiv:1302.2837 cs.DC](https://arxiv.org/abs/1302.2837) -- Examining the Expert Gap in Parallel Programming (Sebastian Nanz, Scott West, Kaue Soares da Silveira) - - [pdf](http://se.inf.ethz.ch/people/west/expert-gap-europar-2013.pdf) -- Acropolis: aggregated client request ordering by Paxos (Jothen) - - https://brage.bibsys.no/xmlui//handle/11250/181825 -- Implementation and experimental evaluation of live replacement and reconfiguration (Lea) - - https://brage.bibsys.no/xmlui//handle/11250/181813 -- Exploiting Parallelism in Coalgebraic Logic Programming (Komendantskaya, Schmidt, Heras) - - https://arxiv.org/abs/1312.4454 -- Parallel Pattern Discovery (Egon Elbre), Master's Thesis, University of Tartu - - [pdf](http://egonelbre.github.io/spexs2/Thesis.pdf) - - [code](https://github.com/egonelbre/spexs2) - -## 2012 -- Time Warp on the Go (D'Angelo, Ferretti, Marzolla) - - [arxiv:1206.2772 cs.DC](https://arxiv.org/abs/1206.2772) -- Can Go address the multicore issues of today and the manycore problems of tomorrow? (S. Binet) - - [pdf](http://iopscience.iop.org/article/10.1088/1742-6596/368/1/012017) -- GoCxx: a tool to easily leverage C++ legacy code for multicore-friendly Go libraries and frameworks (S. Binet) - - [pdf](http://iopscience.iop.org/article/10.1088/1742-6596/396/5/052012) -- The Buffered π-Calculus: A Model for Concurrent Languages (Deng, Zhang, Deng, Zhong) - - [arxiv:1212.6183 cs.LO](https://arxiv.org/abs/1212.6183) -- Analysis of the Go runtime scheduler (Neil Deshpande,Erica Sponsler,Nathaniel Weiss) - - [pdf](http://www1.cs.columbia.edu/~aho/cs6998/reports/12-12-11_DeshpandeSponslerWeiss_GO.pdf) -- A Comparative Study of Programming Models for Concurrency ( Kaue Soares da Silveira) – Porto Alegre: COMGRAD CIC UFRGS, 2012. Final Report (Bachelor) - - [pdf](ftp://ftp.inf.ufrgs.br/pub/geyer/Alunos/KaueSilveira/TG-ComparacaoLinguagensConcorrencia-kaue_soares_da_silveira.pdf) -- Debian Code Search (Stapelberg) - - [pdf](https://codesearch.debian.net/research/bsc-thesis.pdf) -- Go’s Concurrency Constructs on the SCC (Prell, Rauber) - - [pdf](https://hal.inria.fr/file/index/docid/718924/filename/MARC6_Gos-Concurrency-Constructs-on-the-SCC.pdf) -- Comparing Parallel Performance of Go and C++ TBB on a Direct Acyclic Task Graph Using a Dynamic Programming Problem (Serfass, Tang) - - http://www.ualr.edu/pxtang/papers/ACMSE12-comparing.pdf - - -## 2011 -- ng: What next-generation languages can teach us about HENP frameworks in the manycore era (S. Binet) - - [pdf](http://iopscience.iop.org/article/10.1088/1742-6596/331/4/042002) -- Serving Web Content with Dynamic Process Networks in Go (James Whitehead II) - - [DOI: 10.3233/978-1-60750-774-1-209](http://dx.doi.org/10.3233/978-1-60750-774-1-209) - - [pdf](http://www.cs.ox.ac.uk/people/jim.whitehead/cpa2011-draft.pdf) - -## 2010 -- GoHotDraw: Evaluating the Go Programming Language with Design Patterns (Schmager, Cameron, Noble) - - [pdf](http://www.doc.ic.ac.uk/~ncameron/papers/schmager_plateau10.pdf) \ No newline at end of file diff --git a/Resolving-Problems-From-Modified-Module-Path.md b/Resolving-Problems-From-Modified-Module-Path.md index ca0d54ab..a1c7c1da 100644 --- a/Resolving-Problems-From-Modified-Module-Path.md +++ b/Resolving-Problems-From-Modified-Module-Path.md @@ -1,167 +1,4 @@ -## Unexpected module path +The Go wiki on GitHub has moved to go.dev (#61940). -A user working on their project, `my-go-project`, might run into an error during `go get -u` as such: - -``` -$ cd my-go-project -$ go get -u ./... -[...] -go: github.com/golang/lint@v0.0.0-20190313153728-d0100b6bd8b3: parsing go.mod: unexpected module path "golang.org/x/lint" -[...] -Exit code 1 -``` - -`golang.org/x/lint` is a module whose git repository and module name used to be `github.com/golang/lint` before migrating to the git repo `golang.org/x/lint` and renaming its module name to `golang.org/x/lint`. The Go tool currently stumbles trying to understand the old module name at the new git repository: [golang/go#30831](https://github.com/golang/go/issues/30831). - -This was surfaced to `my-go-project` because `my-go-project` or one of its transitive dependencies has a route in the module graph to the old `github.com/golang/lint` module name. - -For example, if `my-go-project` itself relies on the old `github.com/golang/lint` module name: - -``` -$ GO111MODULE=on go mod graph -my-go-project github.com/golang/lint@v0.0.0-20180702182130-06c8688daad7 -``` - -Or, perhaps `my-go-project` depends on an old version of `google.golang.org/grpc` which depends on the old `github.com/golang/lint` module name: - -``` -$ GO111MODULE=on go mod graph -my-go-project google.golang.org/grpc@v1.16.0 -google.golang.org/grpc@v1.16.0 github.com/golang/lint@v0.0.0-20180702182130-06c8688daad7 -``` - -Finally, perhaps `my-go-project` depends on another dependency that requires an old version of `google.golang.org/grpc`, which in turn depends on the old `github.com/golang/lint` module name: - -``` -$ GO111MODULE=on go mod graph -my-go-project some/dep@v1.2.3 -... -another/dep@v1.4.2 google.golang.org/grpc@v1.16.0 -google.golang.org/grpc@v1.16.0 github.com/golang/lint@v0.0.0-20180702182130-06c8688daad7 -``` - -## Removing References To The Name - -Until the Go tool is updated to understand a module which has changed its module path (tracking in [golang/go#30831](https://github.com/golang/go/issues/30831)), the solution to this is to update the graph so that there are no more paths to the old module name. - -Using the examples above, we'll explore updating the graph so that there are no more paths to `github.com/golang/lint`. - -Fixing the first example is simple, the only link is from `my-go-project` - which the user controls! Replacing the old location with the new in the `go.mod` - `github.com/golang/lint@v0.0.0-20180702182130-06c8688daad7` with `golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f` - removes the link from the graph: - -``` -$ GO111MODULE=on go mod graph -my-go-project golang.org/x/lint@v0.0.0-20190301231843-5614ed5bae6f -``` - -Fixing the second example involves more steps but is essentially the same process: `google.golang.org/grpc@v1.16.0` provides the link to `github.com/golang/lint`, so `google.golang.org/grpc` should update its `go.mod` from `github.com/golang/lint@v0.0.0-20180702182130-06c8688daad7` to `golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f` (this thankfully already happened in `v1.17.0`). Then, `my-go-project` should update its `go.mod` to include the new version of `google.golang.org/grpc`, so that we now have: - -``` -$ GO111MODULE=on go mod graph -my-go-project google.golang.org/grpc@v1.17.0 -google.golang.org/grpc@v1.17.0 golang.org/x/lint@v0.0.0-20181026193005-c67002cb31c3 -``` - -Fixing the third example is similar to the second: update to a newer version of `another/dep` which brings in the newer version of `google.golang.org/grpc` which does not contain a reference to `github.com/golang/lint`. - -Hooray! Problems solved - there are no more paths to `github.com/golang/lint` for the Go tool to consider, so it does not trip up on this problem during `go get -u`. - -## A Harder Problem: Removing Trailing History - -This is all well and good, and should satisfy most user's problems. - -However, there is one situation that ends up being quite a bit more involved: when there are cycles in the module dependency graph. Consider this module dependency graph: - -![Module Dependency Graph With A Cycle](https://github.com/jadekler/module-testing/blob/master/imagery/Mod%20Graph%20With%20Cycle.jpg) - -And, let's imagine that `some/lib` used to depend on `github.com/golang/lint`. - -Let's look at this module dependency graph with versions included: - -``` -$ go mod graph -my-go-lib some/lib@v1.7.0 -some/lib@v1.7.0 some-other/lib@v2.5.3 -some/lib@v1.7.0 golang.org/x/lint@v0.0.0-20181026193005-c67002cb31c3 -some-other/lib@v2.5.3 some/lib@v1.6.0 -some/lib@v1.6.0 some-other/lib@v2.5.0 -some/lib@v1.6.0 golang.org/x/lint@v0.0.0-20181026193005-c67002cb31c3 -some-other/lib@v2.5.0 some/lib@v1.3.1 -some/lib@v1.3.1 some-other/lib@v2.4.8 -some/lib@v1.3.1 golang.org/x/lint@v0.0.0-20181026193005-c67002cb31c3 -some-other/lib@v2.4.8 some/lib@v1.3.0 -some/lib@v1.3.0 some-other/lib@v2.4.7 -some/lib@v1.3.0 github.com/golang/lint@v0.0.0-20180702182130-06c8688daad7 -``` - -Visualized with [golang.org/x/exp/cmd/modgraphviz](https://pkg.go.dev/golang.org/x/exp/cmd/modgraphviz): - -![A Module Dependency Graph With Trailing History](https://github.com/jadekler/module-testing/blob/master/imagery/graph1.png) - -Here we see that even though the last several versions of `some/lib` correctly depend on `golang.org/x/lint`, the fact that `some/lib` and `some-other/lib` share a cycle mean that there's very likely to be a path far back in time. - -The reason such paths occur is because the process of bumping versions is usually individually atomic: when `some/lib` bumps its version of `some-other/lib` and release a new version of itself, the latest version of `some-other/lib` still depends on the previous version of `some/lib`. That is, no individual bump of either of these libraries will be enough to remove the chain into history. - -To remove the chain into history and remove the old `github.com/golang/lint` reference from the graph for good, both libraries have to bump their versions of each other at the same time. - -## Atomically Version Bumping Two Libraries - -The solution to removing `github.com/golang/lint` is to first make sure `some/lib` doesn't depend on `github.com/golang/lint`, and then to bump both `some/lib` and `some-other/lib` to non-existent future versions of each other. We want this kind of a graph: - -``` -my-go-lib some/lib@v1.7.1 -some/lib@v1.7.1 some-other/lib@v2.5.4 -some/lib@v1.7.1 golang.org/x/lint@v0.0.0-20181026193005-c67002cb31c3 -some-other/lib@v2.5.4 some/lib@v1.7.1 -``` - -![A Module Dependency Graph Without Trailing History](https://github.com/jadekler/module-testing/blob/master/imagery/graph2.png) - -Since `some/lib` and `some-other/lib` depend on each other at the same version, there's no path backwards in time to a point where `github.com/golang/lint` is provided. - -Here are the steps to achieve this atomic version bump, assuming `some/lib` is at `v1.7.0` and `some-other/lib` is at `v2.5.3`: - -1. Verify that the error does in fact exist: - 1. Run `GO111MODULE=on go get -u ./...` in `some/lib` and `some-other/lib`. - 1. In both repos you should observe the error go: `github.com/golang/lint@v0.0.0-20190313153728-d0100b6bd8b3: parsing go.mod: unexpected module path "golang.org/x/lint"`. -1. Verify that the latest version of `some/lib` depends on `golang.org/x/lint` instead of `github.com/golang/lint`. It would be a shame to remove the historical trails but keep the broken dependency to `github.com/golang/lint`! -1. Bump both libs to non-existent future versions of each other using alpha tags (which are safer since go modules won't consider alpha versions as newer when evaluating the latest released version of a module): - 1. `some/lib` changes its `some-other/lib` dependency from `v2.5.3` to `v2.5.4-alpha`. - 1. `some/lib` tags the commit `v1.7.1-alpha` and pushes the commit and tag. - 1. `some-other/lib` changes its `some/lib` dependency from `v1.6.0` to `v1.7.1-alpha`. - 1. `some-other/lib` tags the commit `v2.5.4-alpha` and pushes the commit and tag. -1. Verify results whilst things are still in an alpha state: - 1. `GO111MODULE=on go build ./...` && `go test ./...` in `some/lib`. - 1. `GO111MODULE=on go build ./...` && `go test ./...` in `some-other/lib`. - 1. `GO111MODULE=on go mod graph` in both repos and assert that there's no path to `github.com/golang/lint`. - 1. Note: `go get -u` still will not work because - as mentioned above - alpha versions aren't considered when evaluating latest versions. -1. If everything looks good, continue by once again bumping to non-existent future versions of each other: - 1. `some/lib` changes its `some-other/lib` dependency from `v2.5.4-alpha` to `v2.5.4` - 1. `some/lib` tags the commit `v1.7.1` and pushes the commit and tag. - 1. `some-other/lib` changes its `some/lib` dependency from `v1.7.1-alpha` to `v1.7.1`. - 1. `some-other/lib` tags the commit `v2.5.4` and pushes the commit and tag. -1. Verify that the error no longer exists: - 1. Run `GO111MODULE=on go get -u ./...` in `some/lib` and `some-other/lib`. - 1. No parsing `go.mod: unexpected module path "golang.org/x/lint"` error should occur. -1. Currently, the `go.sum`s of `some/lib` and `some-other/lib` are incomplete. This is due to the fact that we depended upon future, non-existent versions of modules, so we were not able to generate go.sum entries until the process was finished. So let's fix this: - 1. `GO111MODULE=on go mod tidy` in `some/lib`. - 1. Commit, tag the commit `v1.7.2`, and push both commit and tag. - 1. `GO111MODULE=on go mod tidy` in `some-other/lib`. - 1. Commit, tag the commit `v2.5.5`, and push both commit and tag. -1. Finally, let's make sure that `my-go-project` depends on these new versions of `some/lib` and `some-other/lib` which do not have long historical tails: - 1. Change the `my-go-project` `go.mod` entry from `some/lib v1.7.0` to `some/lib 1.7.2`. - 1. Test by running `GO111MODULE=on go get -u ./...` in `my-go-project`. - -Note that between steps 5.b and 5.d, users are broken: a version of `some/lib` has been released that depends on a non-existent version of `some-other/lib`. Therefore, this process should ideally been done real-time so that step 5.d is finished very soon after step 5.b, creating as small a window of breakage as possible. - -## Larger Cycles - -This example explained the process for removing historical trails when there exists a cycle involving two packages in a graph, but what about if there are cycles involving more packages? For example, consider the following graphs: - -![Module Dependency Graph With Four Related Cycles](https://github.com/jadekler/module-testing/blob/master/imagery/Mod%20Graph%20With%204%20Cycle_%20A.jpg) - -![Module Dependency Graph With One Four Vertex Cycle](https://github.com/jadekler/module-testing/blob/master/imagery/Mod%20Graph%20With%204%20Cycle_%20B.jpg) - -Each of these graphs involve cycles (the latter example) or interconnected modules (the former example) involving four modules, instead of the simple two module example we saw earlier. The process is largely the same, though, but this time in step 3 and 5 we're going to bump all four modules to non-existent future versions of each other, and similarly in steps 4 and 6 we're going to test all four modules, and in step 7 fix the go.sum of all four modules. - -More generally, the process above holds for any group of interconnected modules involving any n modules: each major step just involves n modules acting in coordination. +Try or . diff --git a/Resources-for-slog.md b/Resources-for-slog.md index ec6ce630..8381b168 100644 --- a/Resources-for-slog.md +++ b/Resources-for-slog.md @@ -1,59 +1,4 @@ -This page links to projects that use or enhance [`slog`](https://pkg.go.dev/log/slog), the structured logging package for the standard library. +The Go wiki on GitHub has moved to go.dev (#61940). -#### Log formatting -- slog-formatter: Common formatters for slog + helpers for building your own: https://github.com/samber/slog-formatter -- ConsoleHandler (similar to Zap's ConsoleEncoder): https://gist.github.com/wijayaerick/de3de10c47a79d5310968ba5ff101a19 -- logf (attr {key} interpolation, rich tty output): https://pkg.go.dev/github.com/AndrewHarrisSPU/logf (uses lazy Handler stores: https://go.dev/play/p/psdD7KDF5fp ) -- slogd - slog with duration https://github.com/kaihendry/slogd with video https://youtu.be/IsPa11N5pzI -- tinted (colorized) output: https://pkg.go.dev/github.com/lmittmann/tint -- humane: a human-friendly (but still largely structured) slog Handler: https://github.com/telemachus/humane -- slug: a handler that prints colourful logs for humans: https://github.com/dotse/slug -- slogor: A colorful slog handler: https://gitlab.com/greyxor/slogor -- [klog](https://github.com/kubernetes/klog): the text format used by Kubernetes. Provides klog output routing when using the main package's logger and [a simpler logger](https://github.com/kubernetes/klog/tree/main/textlogger) that just writes to stderr. Both slog/logr and go-logr/logr APIs are supported. +Try or . -#### Logger bridge -- Zap Handler, a slog handler that uses Zap: https://github.com/chanchal1987/zaphandler -- [zapr](https://github.com/go-logr/zapr): starting with v1.3.0, both slog/logr and go-logr/logr APIs are supported by the same logger instance. - -#### Logging Middleware -- slog-context: store attributes or the logger in context, read any custom values from context: https://github.com/veqryn/slog-context -- slog-context/otel: automatically read and add OpenTelemetry TraceID and SpanID to logs, and can set Span error code: [github.com/veqryn/slog-context/otel](https://github.com/veqryn/slog-context#opentelemetry-traceid-spanid-extractor) -- slog-dedup: deduplication and sorting of attribute keys, with multiple dedupe policies, useful for json logging: https://github.com/veqryn/slog-dedup - -#### HTTP server middleware -- slog-gin: Gin middleware for slog logger: https://github.com/samber/slog-gin -- slog-echo: Echo middleware for slog logger: https://github.com/samber/slog-echo -- slog-fiber: Fiber middleware for slog logger: https://github.com/samber/slog-fiber -- slog-chi: Chi middleware for slog logger: https://github.com/samber/slog-chi - -#### Log sinks -- Experimental example using both OpenTelemetry and `slog`: https://github.com/justinsb/experiments-slog -- Simple slog handler with opentelemetry tracing: https://github.com/ttys3/slogsimple/tree/main -- slog-datadog: a `slog.Handler` for Datadog: https://github.com/samber/slog-datadog -- slog-rollbar: a `slog.Handler` for Rollbar: https://github.com/samber/slog-rollbar -- slog-sentry: a `slog.Handler` for Sentry: https://github.com/samber/slog-sentry -- slog-syslog: a `slog.Handler` for Syslog: https://github.com/samber/slog-syslog -- slog-logstash: a `slog.Handler` for Logstash: https://github.com/samber/slog-logstash -- slog-fluentd: a `slog.Handler` for Fluentd: https://github.com/samber/slog-fluentd -- slog-graylog: a `slog.Handler` for Graylog: https://github.com/samber/slog-graylog -- slog-loki: a `slog.Handler` for Loki: https://github.com/samber/slog-loki -- slog-slack: a `slog.Handler` for Slack: https://github.com/samber/slog-slack -- slog-telegram: a `slog.Handler` for Telegram: https://github.com/samber/slog-telegram -- slog-mattermost: a `slog.Handler` for Mattermost: https://github.com/samber/slog-mattermost -- slog-microsoft-teams: a `slog.Handler` for Microsoft Teams: https://github.com/samber/slog-microsoft-teams -- slog-webhook: a `slog.Handler` for Webhook: https://github.com/samber/slog-webhook -- slog-kafka: a `slog.Handler` for Kafka: https://github.com/samber/slog-kafka -- slog-bugsnag: a `slog.Handler` for Bugsnag: https://github.com/veqryn/slog-bugsnag -- slogdriver: a `slog.Handler` for Stackdriver Logging / GCP Cloud Logging: https://github.com/jussi-kalliokoski/slogdriver - -#### Handlers -- slog-multi: chain of `slog.Handler` (pipeline, fanout, ...): https://github.com/samber/slog-multi -- various handlers: https://github.com/galecore/xslog - -#### Other: -- Additional resources written by jba: https://github.com/jba/slog -- slog-sampling: drop repetitive log entries: https://github.com/samber/slog-sampling -- slog-context: adds support to reading values from context: https://github.com/PumpkinSeed/slog-context -- slogassert: handle for testing slog logs emitted by code: https://github.com/thejerf/slogassert -- sloggen: generate various helpers for `log/slog`: https://github.com/go-simpler/sloggen -- sloglint: ensure consistent code style when using `log/slog`: https://github.com/go-simpler/sloglint diff --git a/SQLDrivers.md b/SQLDrivers.md index ab983532..870c79ca 100644 --- a/SQLDrivers.md +++ b/SQLDrivers.md @@ -1,77 +1,4 @@ -# SQL database drivers +The Go wiki on GitHub has moved to go.dev (#61940). -The database/sql and database/sql/driver packages are designed for using databases from Go and implementing database drivers, respectively. +Try or . -See the design goals doc: - -> http://golang.org/src/pkg/database/sql/doc.txt - -# Drivers - -Drivers for Go's sql package include: - - * **Amazon AWS Athena**: https://github.com/uber/athenadriver - * **AWS Athena**: https://github.com/segmentio/go-athena - * **AWS DynamoDB**: https://github.com/btnguyen2k/godynamo - * **Apache Avatica/Phoenix**: https://github.com/apache/calcite-avatica-go - * **Apache H2**: https://github.com/jmrobles/h2go - * **Apache Hive**: https://github.com/sql-machine-learning/gohive - * **Apache Ignite/GridGain**: https://github.com/amsokol/ignite-go-client - * **Apache Impala**: https://github.com/bippio/go-impala - * **Azure Cosmos DB**: https://github.com/btnguyen2k/gocosmos - * **ClickHouse** (uses [HTTP API](https://clickhouse.tech/docs/en/interfaces/http/)): https://github.com/mailru/go-clickhouse - * **ClickHouse** (uses [native TCP interface](https://clickhouse.tech/docs/en/interfaces/tcp/)): https://github.com/ClickHouse/clickhouse-go - * **CockroachDB**: Use any PostgreSQL driver - * **Couchbase N1QL**: https://github.com/couchbase/go_n1ql - * **DB2 LUW** (uses cgo): https://github.com/asifjalil/cli - * **DB2 LUW** and **DB2/Z with DB2-Connect**: https://bitbucket.org/phiggins/db2cli (Last updated 2015-08) - * **DB2 LUW, z/OS, iSeries and Informix**: https://github.com/ibmdb/go_ibm_db - * **Databricks**: https://github.com/databricks/databricks-sql-go - * **DuckDB**: https://github.com/marcboeker/go-duckdb - * **Exasol**: (pure Go): https://github.com/exasol/exasol-driver-go - * **Firebird SQL**: https://github.com/nakagami/firebirdsql - * **Genji** (pure go): https://github.com/genjidb/genji - * **Google Cloud BigQuery**: https://github.com/solcates/go-sql-bigquery - * **Google Cloud Spanner**: https://github.com/googleapis/go-sql-spanner - * **Google Cloud Spanner**: https://github.com/rakyll/go-sql-driver-spanner - * **MS ADODB**: https://github.com/mattn/go-adodb - * **MS SQL Server** (pure go): https://github.com/microsoft/go-mssqldb - * **MS SQL Server** (uses cgo): https://github.com/minus5/gofreetds - * **MaxCompute**: https://github.com/sql-machine-learning/gomaxcompute - * **MySQL**: https://github.com/go-sql-driver/mysql/ ` [*] ` - * **MySQL**: https://github.com/siddontang/go-mysql/ ` [**] ` (also handles replication) - * **MySQL**: https://github.com/ziutek/mymysql ` [*] ` - * **ODBC**: https://bitbucket.org/miquella/mgodbc (Last updated 2016-02) - * **ODBC**: https://github.com/alexbrainman/odbc - * **Oracle** (pure go): https://github.com/sijms/go-ora - * **Oracle** (uses cgo): https://github.com/godror/godror - * **Oracle** (uses cgo): https://github.com/mattn/go-oci8 - * **Oracle** (uses cgo): https://gopkg.in/rana/ora.v4 - * **Postgres** (pure Go): https://github.com/jackc/pgx ` [*] ` - * **Postgres** (pure Go): https://github.com/lib/pq ` [*] ` - * **Postgres** (uses cgo): https://github.com/jbarham/gopgsqldriver - * **Presto**: https://github.com/prestodb/presto-go-client - * **QL**: https://pkg.go.dev/modernc.org/ql - * **SAP ASE** (pure go): https://github.com/SAP/go-ase - * **SAP ASE** (uses cgo): https://github.com/SAP/cgo-ase - * **SAP HANA** (pure go): https://github.com/SAP/go-hdb - * **SAP HANA** (uses cgo): https://help.sap.com/viewer/0eec0d68141541d1b07893a39944924e/2.0.03/en-US/0ffbe86c9d9f44338441829c6bee15e6.html - * **SQL over REST**: https://github.com/adaptant-labs/go-sql-rest-driver - * **SQLite** (uses cgo): https://github.com/gwenn/gosqlite - Supports SQLite dynamic data typing - * **SQLite** (uses cgo): https://github.com/mattn/go-sqlite3 ` [*] ` - * **SQLite** (uses cgo): https://github.com/mxk/go-sqlite - * **SQLite**: (pure go): https://modernc.org/sqlite - * **SQLite**: (uses cgo): https://github.com/rsc/sqlite - * **SingleStore**: Use any MySQL driver - * **Snowflake** (pure Go): https://github.com/snowflakedb/gosnowflake - * **Sybase ASE** (pure go): https://github.com/thda/tds - * **Sybase SQL Anywhere**: https://github.com/a-palchikov/sqlago - * **TiDB**: Use any MySQL driver - * **Trino**: https://github.com/trinodb/trino-go-client - * **Vertica**: https://github.com/vertica/vertica-sql-go - * **Vitess**: https://pkg.go.dev/vitess.io/vitess/go/vt/vitessdriver - * **YDB** (pure go): https://github.com/ydb-platform/ydb-go-sdk - * **YQL (Yahoo! Query Language)**: https://github.com/mattn/go-yql - -Drivers marked with ` [*] ` are both included in and pass the compatibility test suite at https://github.com/bradfitz/go-sql-test. -Drivers marked with ` [**] ` pass the compatibility test suite but are not currently included in it. diff --git a/SQLInterface.md b/SQLInterface.md index bcdb7083..95370f6b 100644 --- a/SQLInterface.md +++ b/SQLInterface.md @@ -1,184 +1,4 @@ -# Introduction +The Go wiki on GitHub has moved to go.dev (#61940). -The `database/sql` package provides a generic interface around SQL (or SQL-like) databases. See the [official documentation](https://pkg.go.dev/database/sql/) for details. +Try or . -This page provides example usage patterns. - -# Database driver - -The `database/sql` package must be used in conjunction with a database driver. -See https://go.dev/s/sqldrivers for a list of drivers. - -The documentation below assumes a driver has been imported. - -# Connecting to a database - -[`Open`](https://pkg.go.dev/database/sql/#Open) - is used to create a database handle: - -```go -db, err := sql.Open(driver, dataSourceName) -``` - -Where driver specifies a database driver and dataSourceName -specifies database-specific connection information -such as database name and authentication credentials. - -Note that `Open` does not directly open a database connection: this is deferred -until a query is made. To verify that a connection can be made -before making a query, use the -[`PingContext`](https://pkg.go.dev/database/sql/#DB.PingContext) -method: - -```go -if err := db.PingContext(ctx); err != nil { - log.Fatal(err) -} -``` - -After use, the database is closed using [`Close`](https://pkg.go.dev/database/sql/#DB.Close). - -# Executing queries - -[`ExecContext`](https://pkg.go.dev/database/sql/#DB.ExecContext) -is used for queries where no rows are returned: - -```go -result, err := db.ExecContext(ctx, - "INSERT INTO users (name, age) VALUES ($1, $2)", - "gopher", - 27, -) -``` - -Where result contains the last insert ID and number of -rows affected. The availability of these values is dependent on -the database driver. - -[`QueryContext`](https://pkg.go.dev/database/sql/#DB.QueryContext) -is used for retrieval: - -```go -rows, err := db.QueryContext(ctx, "SELECT name FROM users WHERE age = $1", age) -if err != nil { - log.Fatal(err) -} -defer rows.Close() -for rows.Next() { - var name string - if err := rows.Scan(&name); err != nil { - log.Fatal(err) - } - fmt.Printf("%s is %d\n", name, age) -} -if err := rows.Err(); err != nil { - log.Fatal(err) -} -``` - -[`QueryRowContext`](https://pkg.go.dev/database/sql/#DB.QueryRowContext) -is used where only a single row is expected: - -```go -var age int64 -err := db.QueryRowContext(ctx, "SELECT age FROM users WHERE name = $1", name).Scan(&age) -``` - -Prepared statements can be created with [`PrepareContext`](https://pkg.go.dev/database/sql/#DB.PrepareContext): - -```go -age := 27 -stmt, err := db.PrepareContext(ctx, "SELECT name FROM users WHERE age = $1") -if err != nil { - log.Fatal(err) -} -rows, err := stmt.Query(age) -// process rows -``` - -[`ExecContext`](https://pkg.go.dev/database/sql/#Stmt.ExecContext), [`QueryContext`](https://pkg.go.dev/database/sql/#Stmt.QueryContext) and [`QueryRowContext`](https://pkg.go.dev/database/sql/#Stmt.QueryContext) can be called on statements. After use, a -statement should be closed with [`Close`](https://pkg.go.dev/database/sql/#Stmt.Close). - -# Transactions - -Transactions are started with [`BeginTx`](https://pkg.go.dev/database/sql/#DB.BeginTx): - -```go -tx, err := db.BeginTx(ctx, nil) -if err != nil { - log.Fatal(err) -} -``` - -The [`ExecContext`](https://pkg.go.dev/database/sql/#Tx.ExecContext), [`QueryContext`](https://pkg.go.dev/database/sql/#Tx.QueryContext), [`QueryRowContext`](https://pkg.go.dev/database/sql/#Tx.QueryRowContext) and [`PrepareContext`](https://pkg.go.dev/database/sql/#Tx.PrepareContext) methods already covered can be -used in a transaction. - -A transaction must end with a call to [`Commit`](https://pkg.go.dev/database/sql/#Tx.Commit) or [`Rollback`](https://pkg.go.dev/database/sql/#Tx.Rollback). - -# Dealing with NULL - -If a database column is nullable, one of the types supporting null values should be passed to Scan. - -For example, if the name column in the names table is nullable: - -```go -var name sql.NullString -err := db.QueryRowContext(ctx, "SELECT name FROM names WHERE id = $1", id).Scan(&name) -... -if name.Valid { - // use name.String -} else { - // value is NULL -} -``` - -Only [`NullByte`](https://pkg.go.dev/database/sql/#NullByte), [`NullBool`](https://pkg.go.dev/database/sql/#NullBool), [`NullFloat64`](https://pkg.go.dev/database/sql/#NullFloat64), [`NullInt64`](https://pkg.go.dev/database/sql/#NullInt64), [`NullInt32`](https://pkg.go.dev/database/sql/#NullInt32) [`NullInt16`](https://pkg.go.dev/database/sql/#NullInt16), [`NullString`](https://pkg.go.dev/database/sql/#NullString) and [`NullTime`](https://pkg.go.dev/database/sql/#NullTime) are implemented in -`database/sql`. Implementations of database-specific null types are left -to the database driver. User types supporting `NULL` can be created by implementing interfaces [`database/sql/driver.Valuer`](https://pkg.go.dev/database/sql/driver/#Valuer) and [`database/sql.Scanner`](https://pkg.go.dev/database/sql/#Scanner). - -You can also pass pointer types. Be careful for performance issues as it requires extra memory allocations. - -```go -var name *string -err := db.QueryRowContext(ctx, "SELECT name FROM names WHERE id = $1", id).Scan(&name) -``` - -# Getting a table - -If you want an struct array from your SQL query. - -```go -func getTable[T any](rows *sql.Rows) (out []T) { - var table []T - for rows.Next() { - var data T - s := reflect.ValueOf(&data).Elem() - numCols := s.NumField() - columns := make([]interface{}, numCols) - - for i := 0; i < numCols; i++ { - field := s.Field(i) - columns[i] = field.Addr().Interface() - } - - if err := rows.Scan(columns...); err != nil { - fmt.Println("Case Read Error ", err) - } - - table = append(table, data) - } - return table -} -``` - -Make sure to deal with nulls from the database. - -```go -type User struct { - UUID sql.NullString - Name sql.NullString -} - -rows, err := db.Query("SELECT * FROM Users") -cases := getTable[User](rows) -``` \ No newline at end of file diff --git a/Screencasts.md b/Screencasts.md index 2f0bfc19..3821aa6f 100644 --- a/Screencasts.md +++ b/Screencasts.md @@ -1,265 +1,4 @@ -# Screencasts +The Go wiki on GitHub has moved to go.dev (#61940). -## Writing, building, installing, and testing Go code +Try or . -A first stop for newcomers to the Go Programming Language. - -This screencast describes setting up a workspace (GOPATH), writing commands and packages, using the go tool to build and install, and using the testing package to write unit tests. - -[[video](http://www.youtube.com/watch?v=XCsL89YtqCs)] - -*** - * **Go for Web Development [Video]** - * Author: Larry Price - * Publication Date: December 29, 2015 - * ISBN:978-1784397982 - -[[video](https://www.packtpub.com/web-development/go-web-development-video/)] - -*** - * **Go: Building Web Applications** - * Authors: Nathan Kozyra, Mat Ryer - * Publication Date: August 2016 - * ISBN:978-1787123496 - -[[Course](https://www.packtpub.com/application-development/go-building-web-applications)] - -*** - * **The Go Programming Language Guide - Code Like a Pro [Video]** - * Author: Eduonix - * Publication Date: September 23, 2016 - * ISBN:978-1787128385 - -[[video](https://www.packtpub.com/application-development/go-programming-language-guide-code-pro-video)] - -*** - * **Go Projects [Video]** - * Authors: Ben Tranter & Rostislav Dzinko - * Publication Date: November 14, 2016 - * ISBN:978-1786460103 - -[[video](https://www.packtpub.com/application-development/go-projects-video)] - -*** - * **Build webapps in Go without using a framework [Video]** - * Authors: Suraj Patil - * Publication Date: December 2016 - -[[Course](https://www.youtube.com/playlist?list=PL41psiCma00wgiTKkAZwJiwtLTdcyEyc4)] - -*** - * **Mastering Go [Video]** - * Authors: Mina Andrawos - * Publication Date: January 31, 2017 - * ISBN:978-1786468239 - -[[video](https://www.packtpub.com/application-development/mastering-go-programming-video)] - -*** - * **Getting started with Cloud Native Go [Video]** - * Author: Mario-Leander Reimer - * Publication Date: February 24, 2017 - * ISBN:978-1787125476 - -[[video](https://www.packtpub.com/application-development/getting-started-cloud-native-go)] - -*** - * **Introduction to Go Classical Patterns [Video]** - * Author: Mario Castro Contreras - * Publication Date: April 27, 2017 - * ISBN:978-1788398039 - -[[video](https://www.packtpub.com/application-development/introduction-go-classical-patterns-video)] - -*** - * **Go Essentials for Full Stack Web Development [Video]** - * Author: Kamesh Balasubramanian - * Publication Date: April 30, 2017 - * ISBN:978-1787280946 - -[[video](https://www.packtpub.com/web-development/go-essentials-full-stack-web-development-video)] - -*** - * **Go Behavioral Patterns [Video]** - * Author: Mario Castro Contreras - * Publication Date: May 27, 2017 - * ISBN:978-1788397377 - -[[video](https://www.packtpub.com/application-development/go-behavioral-patterns-video)] - -*** - * **Go Concurrency [Video]** - * Author: Mario Castro Contreras - * Publication Date: May 30, 2017 - * ISBN:978-1788394161 - -[[video](https://www.packtpub.com/application-development/go-concurrency-video)] - -*** - * **Advanced Cloud Native Go [Video]** - * Author: Mario-Leander Reimer - * Publication Date: May 31, 2017 - * ISBN:978-1787286238 - -[[video](https://www.packtpub.com/application-development/advanced-cloud-native-go-video)] - -*** - * **Go: Building 7 Real-World Projects [Video]** - * Author: Ben Tranter, Rostislav Dzinko and Mat Ryer - * Publication Date: May 31, 2017 - * ISBN:978-1788290494 - -[[course](https://www.packtpub.com/application-development/go-building-7-real-world-projects)] - -*** - * **Modern Golang Programming [Video]** - * Author: Mina Andrawos - * Publication Date: June 23, 2017 - * ISBN:978-1787125254 - -[[video](https://www.packtpub.com/web-development/modern-golang-programming-video)] - -*** - * **Back-End Web Development using Go [Video]** - * Author: Kamesh Balasubramanian - * Publication Date: June 30, 2017 - * ISBN:978-1788392761 - -[[video](https://www.packtpub.com/web-development/back-end-web-development-using-go-video)] - -*** - * **Getting started with Go Programming Language** - * Author: Matthew Spaulding - * Publication Date: August 2017 - * ISBN: 978-1788471855 - -[[course]( https://www.packtpub.com/networking-and-servers/getting-started-go-programming-language-integrated-course)] - -*** - * **Beginner Solutions in Go – The Basics, Clients, and Servers [Video]** - * Author: Aaron Torres - * Publication Date: August 2017 - * ISBN: 978-1788629089 - -[[video]( https://www.packtpub.com/application-development/beginner-solutions-go-%E2%80%93-basics-clients-and-servers-video)] - -*** - * **Front-End Web Development using Go (Video)** - * Author: Kamesh Balasubramanian - * Publication Date: September 2017 - * ISBN: 978-1788398916 - -[[video](https://www.packtpub.com/web-development/front-end-web-development-using-go-video)] - -*** - * **Advanced Solutions in Go – Testing and Distributed Systems** - * Author: Aaron Torres - * Publication Date: September 2017 - * ISBN: 978-1788627887 - -[[video](https://www.packtpub.com/application-development/advanced-solutions-go-%E2%80%93-testing-and-distributed-systems-video)] - -*** - * **Go Standard Library Solutions (Video)** - * Author: Johnny Boursiquot - * Publication Date: November 2017 - * ISBN: 978-1788474160 - -[[video](https://www.packtpub.com/application-development/go-standard-library-solutions-video)] - -*** -* **Machine Learning with Go [Video]** - * Author: Daniel Whitenack - * Publication Date: February 2018 - * ISBN: 9781789134735 - -[[video](https://www.packtpub.com/big-data-and-business-intelligence/machine-learning-go-video)] - -*** -* **Go Production Deployments [Video]** - * Author: Kamesh Balasubramanian - * Publication Date: March 2018 - * ISBN: 9781788399340 - -[[video](https://www.packtpub.com/web-development/go-production-deployments-video)] - -*** -* **Network Programming with Go [Video]** - * Author: Vladimir Vivien - * Publication Date: April 2018 - * ISBN: 9781788476560 - -[[video](https://www.packtpub.com/networking-and-servers/network-programming-go-video)] - -*** -* **Learning Go Data Structures and Algorithms [Video]** - * Author: Gustavo Chaín - * Publication Date: May 2018 - * ISBN: 9781788392563 - -[[video](https://www.packtpub.com/application-development/learning-go-data-structures-and-algorithms-video)] - -*** -* **Hands-on with Go [Video]** - * Author: Tarik Guney - * Publication Date: May 2018 - * ISBN: 9781789132519 - -[[video](https://www.packtpub.com/networking-and-servers/network-programming-go-video)] - -*** - * **Learn Go in 3 Hours [Video]** - * Author: Jonathan Bodner - * Publication Date: June 2018 - * ISBN: 9781788992053 - -[[video](https://www.packtpub.com/application-development/learn-go-3-hours-video)] - -*** - * **Hands-on Serverless Computing with Go [Video]** - * Author: Matthew Stoodley - * Publication Date: June 2018 - * ISBN: 9781789132830 - -[[video](https://www.packtpub.com/application-development/hands-serverless-computing-go-video)] - -*** - * **Hands-on Concurrency with Go [Video]** - * Author: Leo Tindall - * Publication Date: July 2018 - * ISBN: 9781788993746 - -[[video](https://www.packtpub.com/application-development/hands-concurrency-go-video)] - -*** - * **Troubleshooting Go Application Development [Video]** - * Author: Shawn Milochik - * Publication Date: July 2018 - * ISBN: 9781788997072 - -[[video](https://www.packtpub.com/application-development/troubleshooting-go-application-development-video)] - -*** - -* **Functional Programming in Go [Video]** - * Author: Erkid Hoxholli - * Publication Date: September 2018 - * ISBN: 9781787283480 - -[[video](https://www.packtpub.com/application-development/functional-programming-go-video)] - -*** - -* **Go Application Development – Tips, Tricks, and Techniques (Video)** - * Author: Martin Helmich - * Publication Date: February 2019 - * ISBN: 9781789134797 - -[[Video](https://www.packtpub.com/application-development/go-application-development-tips-tricks-and-techniques-video)] - -* **Hands-On Microservices with Go [Video]** - * Author: Emiliano Martinez Luque - * Publication Date: May 2019 - * ISBN: 9781788993999 - -[[video](https://www.packtpub.com/application-development/hands-microservices-go-video?utm_source=Golang&utm_medium=referral&utm_campaign=Outreach)] \ No newline at end of file diff --git a/SettingGOPATH.md b/SettingGOPATH.md index f0d152e2..53bb9668 100644 --- a/SettingGOPATH.md +++ b/SettingGOPATH.md @@ -1,88 +1,4 @@ -# Setting `GOPATH` +The Go wiki on GitHub has moved to go.dev (#61940). -The `GOPATH` environment variable specifies the location of your workspace. If no `GOPATH` is set, it is assumed to be `$HOME/go` on Unix systems and `%USERPROFILE%\go` on Windows. If you want to use a custom location as your workspace, you can set the `GOPATH` environment variable. This page explains how to set this variable on various platforms. +Try or . -- [Unix systems](#unix-systems) - * [Go 1.13](#go-113) - * [Bash](#bash) - * [Zsh](#zsh) - * [fish](#fish) -- [Windows](#windows) - * [Go 1.13](#go-113-command-line) - * [Windows 10 (GUI)](#windows-10-gui) - * [Windows 10 (command line)](#windows-10-command-line) - -# Unix systems - -`GOPATH` can be any directory on your system. In Unix examples, we will set it to `$HOME/go` (the default since Go 1.8). Note that `GOPATH` must not be the same path as your Go installation. Another common setup is to set `GOPATH=$HOME`. - -## Go 1.13+ - -```bash -go env -w GOPATH=$HOME/go -``` - -## Bash - -Edit your `~/.bash_profile` to add the following line: -```bash -export GOPATH=$HOME/go -``` - -Save and exit your editor. Then, source your `~/.bash_profile`. -```bash -source ~/.bash_profile -``` - -## Zsh - -Edit your `~/.zshrc` file to add the following line: - -```bash -export GOPATH=$HOME/go -``` -Save and exit your editor. Then, source your `~/.zshrc`. -```bash -source ~/.zshrc -``` - -## fish - -```bash -set -x -U GOPATH $HOME/go -``` - -The `-x` is used to specify that this variable should be exported -and the `-U` makes this a universal variable, available to all sessions and -persistent. - -# Windows - -Your workspace can be located wherever you like, -but we'll use `C:\go-work` in this example. - -__NOTE:__ `GOPATH` must not be the same path as your Go installation. - -* Create a folder at `C:\go-work`. -* Right-click on "Start" and click on "Control Panel". Select "System and Security", then click on "System". -* From the menu on the left, select the "Advanced system settings". -* Click the "Environment Variables" button at the bottom. -* Click "New" from the "User variables" section. -* Type `GOPATH` into the "Variable name" field. -* Type `C:\go-work` into the "Variable value" field. -* Click OK. - -## Go 1.13+ (command line) -* Open a command prompt (`Win` + `r` then type `cmd`) or a powershell window (`Win` + `i`). -* Type `go env -w GOPATH=c:\go-work`. - -## Windows 10 (GUI) -There is a faster way to edit `Environment Variables` via search: -* Left click on "Search" and type `env` or `environment`. -* Select "Edit environment variables for your account". -* ... and follow steps above. - -## Windows 10 (command line) -* Open a command prompt (`Win` + `r` then type `cmd`) or a powershell window (`Win` + `i`). -* Type `setx GOPATH %USERPROFILE%\go`. (This will set the `GOPATH` to your `[home folder]\go`, such as `C:\Users\yourusername\go`.) -* Close the command or PowerShell window. (The environment variable is only available for new command or PowerShell windows, not for the current window.) \ No newline at end of file diff --git a/SignalHandling.md b/SignalHandling.md index a61e6d5a..36a010fd 100644 --- a/SignalHandling.md +++ b/SignalHandling.md @@ -1,29 +1,4 @@ -# Introduction +The Go wiki on GitHub has moved to go.dev (#61940). -Sometimes an application needs to save internal state or perform some cleanup activity before it exits, or needs to be able to reload a configuration file or write a memory/cpu profile on demand. In UNIX-like operating systems, signals can accomplish these tasks. +Try or . -# Example - -The following code demonstrates a program that waits for an interrupt signal and removes a temporary file when it occurs. - -```go -package main - -import ( - "io/ioutil" - "os" - "os/signal" -) - -func main() { - f, err := ioutil.TempFile("", "test") - if err != nil { - panic(err) - } - defer os.Remove(f.Name()) - defer f.Close() - sig := make(chan os.Signal, 1) - signal.Notify(sig, os.Interrupt) - <-sig -} -``` \ No newline at end of file diff --git a/SimultaneousAssignment.md b/SimultaneousAssignment.md index 69aa333f..2ad52fcc 100644 --- a/SimultaneousAssignment.md +++ b/SimultaneousAssignment.md @@ -1,18 +1,4 @@ -# Simultaneous Assignment +The Go wiki on GitHub has moved to go.dev (#61940). -Simultaneous assignment is useful in many cases to make related assignments in a single statement. Sometimes they are required, either because only a single statement is available (e.g. in an if statement) or because the values will change after the statement (e.g. in the case of swap). All values on the right-hand side of the assignment operator are evaluated before the assignment is performed. +Try or . -Simultaneous assignment in an if statement can improve readability, especially in test functions: -``` -if got, want := someFunction(...), currTest.Expected; got != want { - t.Errorf("%d. someFunction(...) = %v, want %v", currIdx, got, want) -} -``` - -Swapping two values is also made simple using simultaneous assignment: - -``` -i, j = j, i -``` - -https://go.dev/ref/spec#Assignments \ No newline at end of file diff --git a/SliceTricks.md b/SliceTricks.md index 9f1c2076..9d23c098 100644 --- a/SliceTricks.md +++ b/SliceTricks.md @@ -1,309 +1,4 @@ -Since the introduction of the ` append ` built-in, most of the functionality of the ` container/vector ` package, which was removed in Go 1, can be replicated using ` append ` and ` copy `. +The Go wiki on GitHub has moved to go.dev (#61940). -Since the introduction of generics, generic implementations of several of these functions are available in the [`golang.org/x/exp/slices`](https://pkg.go.dev/golang.org/x/exp/slices) package. +Try or . -Here are the vector methods and their slice-manipulation analogues: - -#### AppendVector -```go -a = append(a, b...) -``` - -#### Copy -```go -b := make([]T, len(a)) -copy(b, a) - -// These two are often a little slower than the above one, -// but they would be more efficient if there are more -// elements to be appended to b after copying. -b = append([]T(nil), a...) -b = append(a[:0:0], a...) - -// This one-line implementation is equivalent to the above -// two-line make+copy implementation logically. But it is -// actually a bit slower (as of Go toolchain v1.16). -b = append(make([]T, 0, len(a)), a...) -``` - -#### Cut -```go -a = append(a[:i], a[j:]...) -``` - -#### Delete -```go -a = append(a[:i], a[i+1:]...) -// or -a = a[:i+copy(a[i:], a[i+1:])] -``` - -#### Delete without preserving order -```go -a[i] = a[len(a)-1] -a = a[:len(a)-1] - -``` -**NOTE** If the type of the element is a _pointer_ or a struct with pointer fields, which need to be garbage collected, the above implementations of ` Cut ` and ` Delete ` have a potential _memory leak_ problem: some elements with values are still referenced by slice ` a `'s underlying array, just not "visible" in the slice. Because the "deleted" value is referenced in the underlying array, the deleted value is still "reachable" during GC, even though the value cannot be referenced by your code. If the underlying array is long-lived, this represents a leak. The following code can fix this problem: -> **Cut** -```go -copy(a[i:], a[j:]) -for k, n := len(a)-j+i, len(a); k < n; k++ { - a[k] = nil // or the zero value of T -} -a = a[:len(a)-j+i] -``` - -> **Delete** -```go -copy(a[i:], a[i+1:]) -a[len(a)-1] = nil // or the zero value of T -a = a[:len(a)-1] -``` - -> **Delete without preserving order** -```go -a[i] = a[len(a)-1] -a[len(a)-1] = nil -a = a[:len(a)-1] -``` - -#### Expand -Insert `n` elements at position `i`: -```go -a = append(a[:i], append(make([]T, n), a[i:]...)...) -``` - -#### Extend -Append `n` elements: -```go -a = append(a, make([]T, n)...) -``` - -#### Extend Capacity -Make sure there is space to append `n` elements without re-allocating: -```go -if cap(a)-len(a) < n { - a = append(make([]T, 0, len(a)+n), a...) -} -``` - -#### Filter (in place) - -```go -n := 0 -for _, x := range a { - if keep(x) { - a[n] = x - n++ - } -} -a = a[:n] -``` - -#### Insert -```go -a = append(a[:i], append([]T{x}, a[i:]...)...) -``` -**NOTE**: The second ` append ` creates a new slice with its own underlying storage and copies elements in ` a[i:] ` to that slice, and these elements are then copied back to slice ` a ` (by the first ` append `). The creation of the new slice (and thus memory garbage) and the second copy can be avoided by using an alternative way: -> **Insert** -```go -s = append(s, 0 /* use the zero value of the element type */) -copy(s[i+1:], s[i:]) -s[i] = x -``` - -#### InsertVector -```go -a = append(a[:i], append(b, a[i:]...)...) - -// The above one-line way copies a[i:] twice and -// allocates at least once. -// The following verbose way only copies elements -// in a[i:] once and allocates at most once. -// But, as of Go toolchain 1.16, due to lacking of -// optimizations to avoid elements clearing in the -// "make" call, the verbose way is not always faster. -// -// Future compiler optimizations might implement -// both in the most efficient ways. -// -// Assume element type is int. -func Insert(s []int, k int, vs ...int) []int { - if n := len(s) + len(vs); n <= cap(s) { - s2 := s[:n] - copy(s2[k+len(vs):], s[k:]) - copy(s2[k:], vs) - return s2 - } - s2 := make([]int, len(s) + len(vs)) - copy(s2, s[:k]) - copy(s2[k:], vs) - copy(s2[k+len(vs):], s[k:]) - return s2 -} - -a = Insert(a, i, b...) -``` - -#### Push -```go -a = append(a, x) -``` - -#### Pop -```go -x, a = a[len(a)-1], a[:len(a)-1] -``` - -#### Push Front/Unshift -```go -a = append([]T{x}, a...) -``` - -#### Pop Front/Shift -```go -x, a = a[0], a[1:] -``` - -## Additional Tricks -### Filtering without allocating - -This trick uses the fact that a slice shares the same backing array and capacity as the original, so the storage is reused for the filtered slice. Of course, the original contents are modified. - -```go -b := a[:0] -for _, x := range a { - if f(x) { - b = append(b, x) - } -} -``` - -For elements which must be garbage collected, the following code can be included afterwards: - -```go -for i := len(b); i < len(a); i++ { - a[i] = nil // or the zero value of T -} -``` - -### Reversing - -To replace the contents of a slice with the same elements but in reverse order: -```go -for i := len(a)/2-1; i >= 0; i-- { - opp := len(a)-1-i - a[i], a[opp] = a[opp], a[i] -} -``` -The same thing, except with two indices: -```go -for left, right := 0, len(a)-1; left < right; left, right = left+1, right-1 { - a[left], a[right] = a[right], a[left] -} -``` - -### Shuffling - -Fisher–Yates algorithm: - -> Since go1.10, this is available at [math/rand.Shuffle](https://pkg.go.dev/math/rand#Shuffle) - -```go -for i := len(a) - 1; i > 0; i-- { - j := rand.Intn(i + 1) - a[i], a[j] = a[j], a[i] -} -``` - -### Batching with minimal allocation - -Useful if you want to do batch processing on large slices. - -```go -actions := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} -batchSize := 3 -batches := make([][]int, 0, (len(actions) + batchSize - 1) / batchSize) - -for batchSize < len(actions) { - actions, batches = actions[batchSize:], append(batches, actions[0:batchSize:batchSize]) -} -batches = append(batches, actions) -``` - -Yields the following: -```go -[[0 1 2] [3 4 5] [6 7 8] [9]] -``` - -### In-place deduplicate (comparable) - -```go -import "sort" - -in := []int{3,2,1,4,3,2,1,4,1} // any item can be sorted -sort.Ints(in) -j := 0 -for i := 1; i < len(in); i++ { - if in[j] == in[i] { - continue - } - j++ - // preserve the original data - // in[i], in[j] = in[j], in[i] - // only set what is required - in[j] = in[i] -} -result := in[:j+1] -fmt.Println(result) // [1 2 3 4] -``` - -### Move to front, or prepend if not present, in place if possible. - -```go -// moveToFront moves needle to the front of haystack, in place if possible. -func moveToFront(needle string, haystack []string) []string { - if len(haystack) != 0 && haystack[0] == needle { - return haystack - } - prev := needle - for i, elem := range haystack { - switch { - case i == 0: - haystack[0] = needle - prev = elem - case elem == needle: - haystack[i] = prev - return haystack - default: - haystack[i] = prev - prev = elem - } - } - return append(haystack, prev) -} - -haystack := []string{"a", "b", "c", "d", "e"} // [a b c d e] -haystack = moveToFront("c", haystack) // [c a b d e] -haystack = moveToFront("f", haystack) // [f c a b d e] -``` - -### Sliding Window -```go -func slidingWindow(size int, input []int) [][]int { - // returns the input slice as the first element - if len(input) <= size { - return [][]int{input} - } - - // allocate slice at the precise size we need - r := make([][]int, 0, len(input)-size+1) - - for i, j := 0, size; j <= len(input); i, j = i+1, j+1 { - r = append(r, input[i:j]) - } - - return r -} -``` \ No newline at end of file diff --git a/SlowBots.md b/SlowBots.md index ccfc32b4..e48077cd 100644 --- a/SlowBots.md +++ b/SlowBots.md @@ -1,76 +1,4 @@ -# SlowBots +The Go wiki on GitHub has moved to go.dev (#61940). -The Go build system supports "SlowBots", which are a way to configure the TryBots (pre-submit builders) to add additional builders into the set of build configurations that TryBots normally run. +Try or . -Normally TryBots only run things that are fast and elastically provisioned. That is, TryBots run tests for ports that are available on Google Cloud where we have tons of capacity and can spin up many VMs at will, sharding out test execution widely so the TryBots complete in 5-10 minutes. - -But sometimes that's not enough. SlowBots let you say that you're cool waiting a long time until some specific set of builders becomes available. (There is often only one physical machine for some configurations, and often backlogged with work, and that builder might be slow too.) - -## Using SlowBots - -Click "Choose Tryjobs" under the commit message and a dialog will appear. - -![A red box indicating the location of the "Choose Tryjobs" button under the commit message.](https://github.com/golang/go/assets/1248668/5bfcb020-8cd2-4635-88a9-03efce4e69ba) - -The dialog will ask you to click checkboxes for the builds you would like to run against your CL. - -![An example of the Choose Tryjobs dialog.](https://github.com/golang/go/assets/1248668/5fc635fb-e968-4e7e-b58c-960a09294b5b) - -Select the builds you would like to run, and click the "Add" button in the dialog. Then, set the `Commit-Queue` = `+1` label as usual. This will add builders to the tryjob set in an advisory role. - -**To block submission on new tryjobs** reference them in the commit message using the `Cq-Include-Trybots` line generated in the "Choose Tryjobs" dialog. Once the commit message is updated, set the `Commit-Queue` = `+1` label again. The `Cq-Include-Trybots` line should be right next to the `Change-Id` line without whitespace, like so: - -![An example of how to use Cq-Include-Trybots](https://github.com/golang/go/assets/1248668/c4ede0cc-eb18-44a7-87e9-032f57f9a429) - -Each build's name roughly indicates what it will do, but below is some more detail: -* Builds may start with `x_$REPO` where `$REPO` is some module like `golang.org/x/$REPO` (such as `x_review-gotip-linux-amd64`). This build will run tests in that repository. If the CL is for the main Go repository, it will test the current `HEAD` of `$REPO` against that version of Go. -* If builds do not start with `x_$REPO` (like `gotip-linux-amd64`), they are testing the main Go repository (including the standard library and toolchain). -* Builds will then always list a Go version to build against, like `gotip` or `go1.21`. The former builds against the `master` branch of the main Go repository, while the latter builds against the `HEAD` of the corresponding release branch. If the CL is for `$REPO`, then `$REPO`'s tests will be run against `HEAD` of the corresponding main Go repository branch. -* Builds then list the OS and CPU architecture (specifically, the `GOOS` and `GOARCH`) to test against. -* Lastly, builds list some modifications, such as `gotip-linux-amd64-longtest-race`. Below is a list of some of the modifications and what they mean: - * `longtest` runs the full suite of tests for the corresponding platform and repository. - * `race` runs tests under the race detector. - * `misccompile` will cross-compile all packages (including test packages) for all supported platforms as a smoke test. The platform for these builds is just the "host" platform for the cross-compilation. - -**There are currently a lot more possible builds listed than what's actually supported or valid.** - -Here are some general guidelines for which SlowBots will work as expected: -* If you're running SlowBots for a CL for one of the `golang.org/x/$REPO` repositories, then all the `x_$REPO-.*` builders will work as expected. Other builds will fail. -* If you're running SlowBots for a CL for the main Go repository, then every build that matches the branch the CL is for will work. For example, if you have a CL for the `master` branch, then every build with a name containing `gotip` will work as expected (`x_tools-gotip-linux-amd64`, `gotip-windows-amd64`, etc.). If you have a CL for the `release-branch.go1.21` branch, then every build with a name containing `go1.21` will work as expected (`x_tools-go1.21-linux-amd64`, `go1.21-windows-amd64`, etc.). - -TODO: Apply these guidelines as filters automatically. - -### Pre-LUCI SlowBots - -We're currently in the middle of a migration to a new open-source CI system created by the Chromium project called LUCI. The above instructions describe how to run SlowBots on LUCI, but not all ports have been migrated to LUCI yet. In the interim, these ports are still available on the old infrastructure. Below are instructions on how to use SlowBots on the old infrastructure. - -* Use the Gerrit web UI to reply and select `Run-TryBot` = `+1` instead of `Commit-Queue` = `+1`. -* **Before clicking "Send"** write a magic comment in the comment section (where it says _Say something nice..._): - -``` -TRY=ppc64le, freebsd, netbsd-386, ios, linux-arm64-packet -``` - -... where the terms after `TRY=` are either: - -* `GOOS` (picks best one) -* `GOARCH` (picks best one) -* `GOOS-GOARCH` (picks best one) -* `specific-builder-name` (you specify it explicitly by its exact name; see the full list at https://farmer.golang.org/builders) - -For the main Go repository, the terms after `TRY=` can also be: - -* `x/repo`, where `repo` is one of the golang.org/x repositories whose tests should be executed. This runs a default builder for the given repo (`linux-amd64` as of writing). -* `x/repo@builder`, where `repo` is as above, and `builder` is a builder name from the [builder list](https://farmer.golang.org/builders). This runs the specified builder for the given repo. For example, `x/sys@linux-arm64-aws`. - -When running TryBots again later, the most recent `TRY=` comment on the current patchset is used. To turn it off set `TRY=` with an empty string after the equals sign. If the current patchset doesn't have a `TRY=` comment, the most recent `TRY=` comment is used. - -#### Pitfalls with Pre-LUCI SlowBots - -* `TRY=` comments are ignored if they're not on the same comment that started the TryBots -* TryBots (and SlowBots) don't run if there's already a TryBot-Result -* The `git-codereview mail` tool's `-trybot` flag doesn't support this yet, so use the web UI. -* If TryBots are already running, deleting the `Run-TryBot+1` vote and re-doing it won't re-start the TryBot set, so it won't look at your TRY= line, until the next run when it's done. (But you'll need to delete the TryBot-Result somehow: manually, rebasing, uploading new version) -* If you select a builder that's offline, it'll currently just wait forever for it to show up. There's no timeout yet. -* If you specify an unknown `TRY=` token, it'll just ignore it and won't report an error. -* There's no `all` alias. That's kinda intentional, to prevent overuse that might cause the SlowBots to get even slower for everybody. But we might add it later anyway. See [golang.org/issue/34501#issuecomment-544585711](https://go.dev/issue/34501#issuecomment-544585711). \ No newline at end of file diff --git a/Solaris.md b/Solaris.md index f616f6f0..aa55b605 100644 --- a/Solaris.md +++ b/Solaris.md @@ -1,7 +1,4 @@ -# Go on Solaris +The Go wiki on GitHub has moved to go.dev (#61940). -| **Kernel version** | **Architectures** | **Initial support version** | **Final support version** | -|:-------------------|:------------------|:----------------------------|:--------------------------| -| SunOS 5.11 | amd64 | Go 1.3 _*_ | | +Try or . -_*_ Go 1.5 or above is recommended. \ No newline at end of file diff --git a/Spectre.md b/Spectre.md index 59fb75d0..5cc026aa 100644 --- a/Spectre.md +++ b/Spectre.md @@ -1,53 +1,4 @@ -## Overview +The Go wiki on GitHub has moved to go.dev (#61940). -Go 1.15 adds support for enabling code generation adjustments to mitigate the effect of two variants of the Spectre family of CPU vulnerabilities. The compiler and assembler both have a new flag `-spectre` that is given a list of Spectre mitigations to enable, as in `-spectre=index` or `-spectre=index,ret`. The special case `-spectre=all` enables all available mitigations. +Try or . -The `index` mitigation can be enabled in the compiler and changes code generation to emit protections against Spectre variant 1 (“bounds check bypass”). The mitigation ensures that the CPU does not access arbitrary memory, by masking the index to zero when speculating incorrectly. This change typically slows down execution by around 5-10%; the exact slowdown depends on the workload. - -The `ret` mitigation can be enabled in both the compiler and the assembler and changes code generation to emit protections against Spectre variant 2 (“branch target injection”). This mitigation replaces every indirect call instructions with use of a retpoline gadget. This change typically slows down execution by around 10-15%; again, the exact slowdown depends on the workload. - -## Applicability - -At time of writing, we do not use either of these mitigations for Go programs running at Google, nor do we anticipate doing so. They are included in the Go toolchain as a kind of “defense in depth” for users with very special use cases (or significant paranoia). - -These mitigations would only be necessary when there is a potential Spectre attack against a Go program, which would require all of the following to be true. -First, an attacker must be able to run arbitrary code on the same CPUs as a victim Go program containing a secret. -Second, the attacker must be able to make some kind of HTTP or RPC requests to the victim Go program. -Third, those requests have to trigger a potentially vulnerable code fragment to speculate into attacker-selected behavior. Most commonly this would mean using an arbitrary attacker-provided integer to index a slice or array. -These three conditions are only very rarely all true at the same time. - -## Example - -To build a program with both mitigations (and any future mitigations) enabled in all packages, use: - - go build -gcflags=all=-spectre=all -asmflags=all=-spectre=all program - -## Acknowledgements - -Thanks to Andrea Mambretti _et al_. for sharing their paper (linked below) ahead of publication. And thanks to them, Chandler Carruth, and Paul Turner for helpful discussions. - -## References - -“[Spectre Attacks: Exploiting Speculative Execution](https://spectreattack.com/spectre.pdf)”\ -by Paul Kocher _et al_. (The definitive paper.) - -“[Speculative Buffer Overflows: Attacks and Defenses](https://people.csail.mit.edu/vlk/spectre11.pdf)”\ -by Vladimir Kiriansky and Carl Waldspurger. - -“[Retpoline: a software construct for preventing branch-target-injection](https://support.google.com/faqs/answer/7625886)”\ -by Paul Turner. - -“[A Systematic Evaluation of Transient Execution Attacks and Defenses](https://arxiv.org/abs/1811.05441)”\ -by Claudio Canella _et al_. (Good summary of variants.) - -“[Spectre is here to stay: An analysis of side-channels and speculative execution](https://arxiv.org/abs/1902.05178)”\ -by Ross McIlroy _et al_. (These are not going away.) - -“[Spectre Returns! Speculation Attacks using the Return Stack Buffer](https://www.usenix.org/system/files/conference/woot18/woot18-paper-koruyeh.pdf)”\ -by Esmaeil Mohammadian Koruyeh _et al_. (Even return prediction isn't safe.) - -“[Speculative Load Hardening](https://llvm.org/docs/SpeculativeLoadHardening.html)”\ -by Chandler Carruth. (What LLVM does to prevent speculative out-of-bounds access.) - -“[Bypassing memory safety mechanisms through speculative control flow hijacks](https://arxiv.org/pdf/2003.05503.pdf)”\ -by Andrea Mambretti _et al_. (Examination of effects on memory-safe languages.) diff --git a/Spelling.md b/Spelling.md index 0c2fde3e..ce56fe50 100644 --- a/Spelling.md +++ b/Spelling.md @@ -1,13 +1,4 @@ -This page documents the spelling choices that the Go project has made for English words. +The Go wiki on GitHub has moved to go.dev (#61940). -This page is a statement of policy. Do not edit it without approval/discussion. +Try or . -Policy: - -* American spellings over British spellings -* **iff** means "if and only if" (https://en.wiktionary.org/wiki/iff), but don't use it in public-facing docs (don't use in comments on exported identifiers that would show up in godoc) -* avoid Latin abbreviations in godoc -* use **cancellation** (two ells), not cancelation. See https://go.dev/cl/170060 -* use **canceled** (one ell), not cancelled. -* use **canceling** (one ell), not cancelling. -* use **marshaling**, **marshaled** etc (single ell). See https://go.dev/cl/33017 diff --git a/Style.md b/Style.md index df17499d..cb6c99a9 100644 --- a/Style.md +++ b/Style.md @@ -1,2 +1,4 @@ -See [CodeReviewComments](/golang/go/wiki/CodeReviewComments), -[TestComments](/golang/go/wiki/TestComments),[CSSStyleGuide](/golang/go/wiki/CSSStyleGuide) or [Google's Go Style Guide](https://google.github.io/styleguide/go/). \ No newline at end of file +The Go wiki on GitHub has moved to go.dev (#61940). + +Try or . + diff --git a/SuccessStories.md b/SuccessStories.md index e1c10ae3..bbeaaf40 100644 --- a/SuccessStories.md +++ b/SuccessStories.md @@ -1,51 +1,4 @@ -# Go success stories from around the web +The Go wiki on GitHub has moved to go.dev (#61940). - * [The Way of the Gopher - Making the Switch from Node.js to Golang](https://medium.com/@theflapjack103/the-way-of-the-gopher-6693db15ae1f) - * [Moving a team from Scala to Go](http://jimplush.com/talk/2015/12/19/moving-a-team-from-scala-to-golang/) - * [400 Days of Go](http://www.philipotoole.com/400-days-of-go/) - * [From Python to Go: Migrating our entire API](https://www.repustate.com/blog/migrating-entire-api-go-python/) - * [Our Experience with Golang](https://www.scriptrock.com/blog/our-experience-with-golang) - * [The Reliability of Go](http://andrewwdeane.blogspot.de/2013/05/the-reliability-of-go.html) - * [Go at TiDB](https://github.com/pingcap/tidb) - * [A Go Redirection Service](https://blog.dnsimple.com/2013/03/golang-redirector/) - * [pool.ntp.org DNS server in Go](http://news.ntppool.org/2012/10/new-dns-server.html) - * [Juju at Canonical](http://www.reddit.com/r/programming/comments/18atce/juju_canonical_109k_lines_of_go_code/) - * [Go at bitly](http://word.bitly.com/post/29550171827/go-go-gadget) - * [NSQ: realtime distributed message processing at scale](http://word.bitly.com/post/33232969144/nsq) - * [CloudFlare blows hole in laws of Web physics with Go and Railgun](http://arstechnica.com/information-technology/2013/02/cloudflare-blows-hole-in-laws-of-web-physics-with-go-and-railgun/) - * [Why I Like Go](https://gist.github.com/freeformz/4746274) - * [Why I Program in Go](http://tech.t9i.in/2013/01/why-program-in-go/) - * [dl.google.com now served by Go](https://groups.google.com/forum/?fromgroups=#!topic/golang-nuts/BNUNbKSypE0) - * [Google's Go Programming Language Grows Up: Now What?](http://readwrite.com/2012/03/29/googles-go-programming-languag/) - * [Moving to Go](http://blog.toggl.com/2012/09/moving-to-go/) - * [Rob Pike: Why Learn Go?](http://www.youtube.com/watch?v=FTl0tl9BGdc) - * [Why I went from Python to Go (and not node.js)](http://jordanorelli.tumblr.com/post/31533769172/why-i-went-from-python-to-go-and-not-node-js) - * [Another go at the Next Big Language](http://dave.cheney.net/2012/09/03/another-go-at-the-next-big-language) - * [@tobi](http://twitter.com/tobi): ["I have now completed two projects in Go. I predict that it's going to be the dominant language for server work."](https://twitter.com/tobi/status/245873677483274240) - * [@derekcollison](http://twitter.com/derekcollison): ["Prediction: Go will become the dominant language for systems work in IaaS, Orchestration, and PaaS in 24 months."](https://twitter.com/derekcollison/status/245522124666716160) - * [Will Go be the new go-to programming language?](http://gigaom.com/cloud/will-go-be-the-new-go-to-programming-language/) - * [Dr. Dobb's: Why Not Go?](http://www.drdobbs.com/open-source/why-not-go/240005062) - * [Google I/O 2012: Go in production](http://www.youtube.com/watch?v=kKQLhGZVN4A) - * [Go at Cockroach Labs](https://www.cockroachlabs.com/blog/why-go-was-the-right-choice-for-cockroachdb/), [cockroachdb/cockroach](https://github.com/cockroachdb/cockroach) - * [Go at Novartis](https://plus.google.com/114945221884326152379/posts/d1SVaqkRyTL) - * [Go at the BBC](http://www.quora.com/Go-programming-language/Is-Google-Go-ready-for-production-use/answer/Kunal-Anand) - * [Go at SoundCloud](https://developers.soundcloud.com/blog/go-at-soundcloud) - * [Go at Moovweb](https://groups.google.com/forum/#!topic/golang-nuts/MeiTNnGhLg8/discussion) - * [Building StatHat with Go](https://go.dev/blog/2011/12/building-stathat-with-go.html) - * [Go at CloudFlare](http://blog.cloudflare.com/go-at-cloudflare) - * [Why you PHP guys should learn Golang](http://www.mikespook.com/2012/08/why-you-php-guys-should-learn-golang/) - * [I/O BootCamp 2011: Real World Go](http://www.youtube.com/watch?v=7QDVRowyUQA) - * [Go at Heroku](https://go.dev/blog/2011/04/go-at-heroku.html) - * [Go at Basecamp](https://signalvnoise.com/posts/3897-go-at-basecamp) - * [Go at Streetspotr](https://thcyron.de/2015/go-at-streetspotr.html) - * [Confession From A Go Programer](https://zeta.si/page/Confession-From-A-Go-Programer) - * [Why we chose Go over C for updating embedded Linux devices](https://mender.io/blog/why-did-we-choose-golang-over-c) - * [List of Tech Migrations](http://kokizzu.blogspot.com/2016/12/list-of-tech-migrations.html) - * [Making the move from Scala to Go, and why we’re not going back](https://movio.co/blog/migrate-Scala-to-Go/) - * [Go + Services = One Goliath Project - Khan Academy's Python Monolith to Go Microservices](https://blog.khanacademy.org/go-services-one-goliath-project/) - * [Why we switched from Python to Go at Stream](https://getstream.io/blog/switched-python-go/) - * [A journey from Node to GoLang](https://www.loginradius.com/engineering/blog/a-journey-from-node-to-golang/) - * [Ready - Steady - Go: A complete IoT platform in Go](https://qbee.io/misc/ready-steady-go-a-complete-iot-platform-in-go/) +Try or . - -See also [[GoUsers]]. \ No newline at end of file diff --git a/Switch.md b/Switch.md index 5d3b577c..82f1d3ca 100644 --- a/Switch.md +++ b/Switch.md @@ -1,248 +1,4 @@ -# Switch +The Go wiki on GitHub has moved to go.dev (#61940). -Spec: https://go.dev/ref/spec#Switch_statements +Try or . -Go's ` switch ` statements are pretty neat. For one thing, you don't need to break at the end of each case. - -```go -switch c { -case '&': - esc = "&" -case '\'': - esc = "'" -case '<': - esc = "<" -case '>': - esc = ">" -case '"': - esc = """ -default: - panic("unrecognized escape character") -} -``` - -[src/pkg/html/escape.go](http://golang.org/src/pkg/html/escape.go#L178) - -## Not just integers - -Switches work on values of any type. - -```go -switch syscall.OS { -case "windows": - sd = &sysDir{ - Getenv("SystemRoot") + `\system32\drivers\etc`, - []string{ - "hosts", - "networks", - "protocol", - "services", - }, - } -case "plan9": - sd = &sysDir{ - "/lib/ndb", - []string{ - "common", - "local", - }, - } -default: - sd = &sysDir{ - "/etc", - []string{ - "group", - "hosts", - "passwd", - }, - } -} -``` - -## Missing expression - -In fact, you don't need to switch on anything at all. A switch with no value means "switch true", making it a cleaner version of an if-else chain, as in this example from Effective Go: - -```go -func unhex(c byte) byte { - switch { - case '0' <= c && c <= '9': - return c - '0' - case 'a' <= c && c <= 'f': - return c - 'a' + 10 - case 'A' <= c && c <= 'F': - return c - 'A' + 10 - } - return 0 -} -``` - -## Break - -Go's ` switch ` statements ` break ` implicitly, but ` break ` is still useful: - -```go -command := ReadCommand() -argv := strings.Fields(command) -switch argv[0] { -case "echo": - fmt.Print(argv[1:]...) -case "cat": - if len(argv) <= 1 { - fmt.Println("Usage: cat ") - break - } - PrintFile(argv[1]) -default: - fmt.Println("Unknown command; try 'echo' or 'cat'") -} -``` - -## Fall through - -To fall through to a subsequent case, use the ` fallthrough ` keyword: - -```go -v := 42 -switch v { -case 100: - fmt.Println(100) - fallthrough -case 42: - fmt.Println(42) - fallthrough -case 1: - fmt.Println(1) - fallthrough -default: - fmt.Println("default") -} -// Output: -// 42 -// 1 -// default -``` - -Another example: - -```go -// Unpack 4 bytes into uint32 to repack into base 85 5-byte. -var v uint32 -switch len(src) { -default: - v |= uint32(src[3]) - fallthrough -case 3: - v |= uint32(src[2]) << 8 - fallthrough -case 2: - v |= uint32(src[1]) << 16 - fallthrough -case 1: - v |= uint32(src[0]) << 24 -} -``` -[src/pkg/encoding/ascii85/ascii85.go](http://golang.org/src/pkg/encoding/ascii85/ascii85.go#L43) - -The 'fallthrough' must be the last thing in the case; you can't write something like - -```go -switch { -case f(): - if g() { - fallthrough // Does not work! - } - h() -default: - error() -} -``` -However, you can work around this by using a 'labeled' `fallthrough`: - -```go -switch { -case f(): - if g() { - goto nextCase // Works now! - } - h() - break -nextCase: - fallthrough -default: - error() -} -``` -Note: `fallthrough` does not work in type switch. - -## Multiple cases - -If you want to use multiple values in the same case, use a comma-separated list. - -```go -func letterOp(code int) bool { - switch chars[code].category { - case "Lu", "Ll", "Lt", "Lm", "Lo": - return true - } - return false -} -``` -## Type switch - -With a type switch you can switch on the type of an interface value (only): - -```go -func typeName(v interface{}) string { - switch v.(type) { - case int: - return "int" - case string: - return "string" - default: - return "unknown" - } -} -``` - -You can also declare a variable and it will have the type of each ` case `: - -```go -func do(v interface{}) string { - switch u := v.(type) { - case int: - return strconv.Itoa(u*2) // u has type int - case string: - mid := len(u) / 2 // split - u has type string - return u[mid:] + u[:mid] // join - } - return "unknown" -} - -do(21) == "42" -do("bitrab") == "rabbit" -do(3.142) == "unknown" -``` - -## Noop case - -Sometimes it useful to have cases that require no action. This can look confusing, because it can appear that both the noop case and the subsequent case have the same action, but isn't so. - -```go -func pluralEnding(n int) string { - ending := "" - - switch n { - case 1: - default: - ending = "s" - } - - return ending -} - -fmt.Sprintf("foo%s\n", pluralEnding(1)) == "foo" -fmt.Sprintf("bar%s\n", pluralEnding(2)) == "bars" - -``` - \ No newline at end of file diff --git a/TableDrivenTests.md b/TableDrivenTests.md index 5b84f859..5e10d6ec 100644 --- a/TableDrivenTests.md +++ b/TableDrivenTests.md @@ -1,127 +1,4 @@ -# Introduction -Writing good tests is not trivial, but in many situations a lot of ground can be covered with table-driven tests: Each table entry is a complete test case with inputs and expected results, and sometimes with additional information such as a test name to make the test output easily readable. If you ever find yourself using copy and paste when writing a test, think about whether refactoring into a table-driven test or pulling the copied code out into a helper function might be a better option. +The Go wiki on GitHub has moved to go.dev (#61940). -Given a table of test cases, the actual test simply iterates through all table entries and for each entry performs the necessary tests. The test code is written once and amortized over all table entries, so it makes sense to write a careful test with good error messages. +Try or . -Table driven testing is not a tool, package or anything else, it's just a way and perspective to write cleaner tests. - -## Example of a table driven test - -Here is a good example from the testing code for the ` fmt ` package ( https://pkg.go.dev/fmt/ ): - -```go -var flagtests = []struct { - in string - out string -}{ - {"%a", "[%a]"}, - {"%-a", "[%-a]"}, - {"%+a", "[%+a]"}, - {"%#a", "[%#a]"}, - {"% a", "[% a]"}, - {"%0a", "[%0a]"}, - {"%1.2a", "[%1.2a]"}, - {"%-1.2a", "[%-1.2a]"}, - {"%+1.2a", "[%+1.2a]"}, - {"%-+1.2a", "[%+-1.2a]"}, - {"%-+1.2abc", "[%+-1.2a]bc"}, - {"%-1.2abc", "[%-1.2a]bc"}, -} -func TestFlagParser(t *testing.T) { - var flagprinter flagPrinter - for _, tt := range flagtests { - t.Run(tt.in, func(t *testing.T) { - s := Sprintf(tt.in, &flagprinter) - if s != tt.out { - t.Errorf("got %q, want %q", s, tt.out) - } - }) - } -} -``` - -Note the detailed error message provided with ` t.Errorf `: its result and expected result are provided; the input is the subtest name. When the test fails it is immediately obvious which test failed and why, even without having to read the test code. - -A ` t.Errorf ` call is not an assertion. The test continues even after an error is logged. For example, when testing something with integer input, it is worth knowing that the function fails for all inputs, or only for odd inputs, or for powers of two. - -## Using a Map to Store Test Cases - -In the previous example, tests cases were stored in a slice of structs. They can be stored in a map as well and there are several advantages -to doing it this way. - -```go -tests := map[string]struct { - input string - result string -} { - "empty string": { - input: "", - result: "", - }, - "one character": { - input: "x", - result: "x", - }, - "one multi byte glyph": { - input: "🎉", - result: "🎉", - }, - "string with multiple multi-byte glyphs": { - input: "🥳🎉🐶", - result: "🐶🎉🥳", - }, -} - -for name, test := range tests { - test := test - t.Run(name, func(t *testing.T) { - t.Parallel() - if got, expected := reverse(test.input), test.result; got != expected { - t.Fatalf("reverse(%q) returned %q; expected %q", test.input, got, expected) - } - }) -} -``` - -One advantage of using maps is that the "name" of each test can simply be the map index. - -More importantly, map iteration order isn't specified nor is it even guaranteed to be the same from one iteration to the next. This ensures that each test is independent of the others and that testing order doesn't impact results. - -## Parallel Testing - -Parallelizing table tests is simple, but requires precision to avoid bugs. -Please note closely the three changes below, especially the re-declaration of `test` - -```go -package main - -import ( - "testing" -) - -func TestTLog(t *testing.T) { - t.Parallel() // marks TLog as capable of running in parallel with other tests - tests := []struct { - name string - }{ - {"test 1"}, - {"test 2"}, - {"test 3"}, - {"test 4"}, - } - for _, test := range tests { - test := test // NOTE: https://github.com/golang/go/wiki/CommonMistakes#using-goroutines-on-loop-iterator-variables - t.Run(test.name, func(t *testing.T) { - t.Parallel() // marks each test case as capable of running in parallel with each other - t.Log(test.name) - }) - } -} -``` - -## References - - * https://go.dev/doc/code#Testing - * https://go.dev/doc/faq#assertions - * https://go.dev/doc/faq#testing_framework - * https://pkg.go.dev/testing/ \ No newline at end of file diff --git a/TargetSpecific.md b/TargetSpecific.md index 3f606ae8..47e21f36 100644 --- a/TargetSpecific.md +++ b/TargetSpecific.md @@ -1,93 +1,4 @@ -# Target-Specific Code +The Go wiki on GitHub has moved to go.dev (#61940). -Sometimes, for performance or compatibility reasons, custom code needs to be written for specific GOARCH and GOOS targets. This page presents some best practices to adopt in that case. It is a required policy for crypto packages as of April 2019. +Try or . -1. **Minimize code in tagged files.** As much code as possible should build for every target. In particular, the generic Go implementation must build also for targets that have an optimized implementation. This is critical for testing the optimized code against the generic Go, and makes it quicker to notice some build failures. The linker will drop unused code from final binaries. - -2. **Name files after their tags**, like `poly1305_amd64.go`. Remember that if a file ends in `_$GOARCH.go`, that counts as a build tag. `_noasm.go` is also a good suffix. - -3. **No exported functions in tagged files.** Exported functions define the public API and its documentation, which must be the same across all targets. Having exported functions repeated in each target-specific file makes it likely for them to get out of sync. The mid-stack inliner will probably take care of some of the performance cost. - -4. **Test all available implementations.** Running `go test` on a target that has an optimized implementation should test both the generic and the optimized code. You can use sub-tests for this. Ideally, benchmarks too. - -5. **Write comparative test.** There should be a test which runs the two implementations for random or edge inputs, and compares the results. As [#19109](https://github.com/golang/go/issues/19109) progresses, these should be fuzz tests. - -Tip: you can test that your code and tests compile for a target easily by running e.g. `GOARCH=arm64 go test -c`. - -## Example - -poly1305.go - -```go -package poly1305 - -// Sum generates an authenticator for m using a one-time key and puts the -// 16-byte result into out. Authenticating two different messages with the same -// key allows an attacker to forge messages at will. -func Sum(out *[16]byte, m []byte, key *[32]byte) { - sum(out, m, key) -} - -func sumGeneric(out *[16]byte, m []byte, key *[32]byte) { - // ... -} -``` - -poly1305_amd64.go - -```go -// +build gc,!purego - -package poly1305 - -//go:noescape -func sum(out *[16]byte, m []byte, key *[32]byte) -``` - -poly1305_amd64.s - -``` -// +build gc,!purego - -// func sum(out *[16]byte, m []byte, key *[32]byte) -TEXT ·sum(SB), $0-128 - // ... -``` - -poly1305_noasm.go - -```go -// +build !amd64 !gc purego - -package poly1305 - -func sum(out *[16]byte, m []byte, key *[32]byte) { - sumGeneric(out, m, key) -} -``` - -poly1305_test.go - -```go -package poly1305 - -import "testing" - -func testSum(t *testing.T, sum func(tag *[16]byte, msg []byte, key *[32]byte)) { - // ... -} - -func TestSum(t *testing.T) { - t.Run("Generic", func(t *testing.T) { testSum(t, sumGeneric) }) - t.Run("Native", func(t *testing.T) { testSum(t, sum) }) -} - -// TestSumCompare checks the output of sum against sumGeneric. -func TestSumCompare(t *testing.T) { - // ... -} -``` - -For more complete examples see the [x/crypto/poly1305](https://github.com/golang/crypto/tree/master/poly1305) and [x/crypto/salsa20/salsa](https://github.com/golang/crypto/tree/master/salsa20/salsa) packages. - -Note that packages in the standard library (as opposed to modules like golang.org/x/crypto) do not use the `gc` and `purego` build tags. \ No newline at end of file diff --git a/TestComments.md b/TestComments.md index 14f4ea48..543c6b28 100644 --- a/TestComments.md +++ b/TestComments.md @@ -1,291 +1,4 @@ -# Go Test Comments +The Go wiki on GitHub has moved to go.dev (#61940). -This page is a supplement to -[Go Code Review Comments](https://github.com/golang/go/wiki/CodeReviewComments), -but is targeted specifically to test code. +Try or . -**Please [discuss changes](https://go.dev/issue/new?title=wiki%3A+TestComments+change&body=&labels=Documentation) -before editing this page**, even _minor_ ones. Many people have opinions and -this is not the place for edit wars. - -* [Assert Libraries](https://github.com/golang/go/wiki/TestComments#assert-libraries) -* [Choose Human-Readable Subtest Names](https://github.com/golang/go/wiki/TestComments#choose-human-readable-subtest-names) -* [Compare Stable Results](https://github.com/golang/go/wiki/TestComments#compare-stable-results) -* [Compare Full Structures](https://github.com/golang/go/wiki/TestComments#compare-full-structures) -* [Equality Comparison and Diffs](https://github.com/golang/go/wiki/TestComments#equality-comparison-and-diffs) -* [Got before Want](https://github.com/golang/go/wiki/TestComments#got-before-want) -* [Identify the Function](https://github.com/golang/go/wiki/TestComments#identify-the-function) -* [Identify the Input](https://github.com/golang/go/wiki/TestComments#identify-the-input) -* [Keep Going](https://github.com/golang/go/wiki/TestComments#keep-going) -* [Mark Test Helpers](https://github.com/golang/go/wiki/TestComments#mark-test-helpers) -* [Print Diffs](https://github.com/golang/go/wiki/TestComments#print-diffs) -* [Table-Driven Tests vs Multiple Test Functions](https://github.com/golang/go/wiki/TestComments#table-driven-tests-vs-multiple-test-functions) -* [Test Error Semantics](https://github.com/golang/go/wiki/TestComments#test-error-semantics) - -## Assert Libraries - -Avoid the use of 'assert' libraries to help your tests. Go developers arriving -from xUnit frameworks often want to write code like: - -```go -assert.IsNotNil(t, "obj", obj) -assert.StringEq(t, "obj.Type", obj.Type, "blogPost") -assert.IntEq(t, "obj.Comments", obj.Comments, 2) -assert.StringNotEq(t, "obj.Body", obj.Body, "") -``` - -but this either stops the test early (if assert calls `t.Fatalf` or `panic`) -or omits interesting information about what the test got right. It also forces -the assert package to create a whole new sub-language instead of reusing the -existing programming language (Go itself). Go has good support for printing -structures, so a better way to write this code is: - -```go -if obj == nil || obj.Type != "blogPost" || obj.Comments != 2 || obj.Body == "" { - t.Errorf("AddPost() = %+v", obj) -} -``` - -Assert libraries make it too easy to write imprecise tests and inevitably end up -duplicating features already in the language, like expression evaluation, -comparisons, sometimes even more. Strive to write tests that are precise both -about what went wrong and what went right, and make use of Go itself instead of -creating a mini-language inside Go. - -## Choose Human-Readable Subtest Names - -When you use `t.Run` to create a subtest, the first argument is used as a -descriptive name for the test. To ensure that test results are legible to humans -reading the logs, choose subtest names that will remain useful and readable -after escaping. (The test runner replaces spaces with underscores, and it -escapes non-printing characters). - -To [identify the inputs](#identify-the-input), use `t.Log` in the body of the -subtest or include them in the test's failure messages, where they won't be -escaped by the test runner. - -## Compare Full Structures - -If your function returns a struct, don't write test code that performs an -individual comparison for each field of the struct. Instead, construct the -struct that you're expecting your function to return, and compare in one shot -using [diffs](#print-diffs) or [deep comparisons](#equality-comparison-and-diffs). -The same rule applies to arrays and maps. - -If your struct needs to be compared for approximate equality or some other -kind of semantic equality, or it contains fields that cannot be compared for -equality (e.g. if one of the fields is an `io.Reader`), tweaking a -[`cmp.Diff`](https://pkg.go.dev/github.com/google/go-cmp/cmp#Diff) or -[`cmp.Equal`](https://pkg.go.dev/github.com/google/go-cmp/cmp#Equal) comparison -with [cmpopts](https://pkg.go.dev/github.com/google/go-cmp/cmp/cmpopts) options -such as [`cmpopts.IgnoreInterfaces`](https://pkg.go.dev/github.com/google/go-cmp/cmp/cmpopts#IgnoreInterfaces) -may meet your needs ([example](https://go.dev/play/p/vrCUNVfxsvF)); -otherwise, this technique just won't work, so do whatever works. - -If your function returns multiple return values, you don't need to wrap those in -a struct before comparing them. Just compare the return values individually and -print them. - -## Compare Stable Results - -Avoid comparing results that may inherently depend on output stability of some -external package that you do not control. Instead, the test should compare on -semantically relevant information that is stable and resistent to changes in -your dependencies. For functionality that returns a formatted string or -serialized bytes, it is generally not safe to assume that the output is stable. - -For example, [`json.Marshal`](https://pkg.go.dev/encoding/json/#Marshal) -makes no guarantee about the exact bytes that it may emit. It has the freedom to -change (and has changed in the past) the output. Tests that perform string -equality on the exact JSON string may break if the `json` package changes how it -serializes the bytes. Instead, a more robust test would parse the contents of -the JSON string and ensure that it is semantically equivalent to some expected -data structure. - - -## Equality Comparison and Diffs - -The `==` operator evaluates equality using the -[language-defined comparisons](https://go.dev/ref/spec#Comparison_operators). -Values it can compare include numeric, string, and pointer values and structs -with fields of those values. In particular, it determines two pointers to be -equal only if they point to the same variable. - -Use the [cmp](https://pkg.go.dev/github.com/google/go-cmp/cmp) package. Use -[`cmp.Equal`](https://pkg.go.dev/github.com/google/go-cmp/cmp#Equal) for equality -comparison and [`cmp.Diff`](https://pkg.go.dev/github.com/google/go-cmp/cmp#Diff) -to obtain a human-readable diff between objects. - -Although the `cmp` package is not part of the Go standard library, it is -maintained by the Go team and should produce stable results across Go version -updates. It is user-configurable and should serve most comparison needs. - -You will find older code using the standard `reflect.DeepEqual` function to -compare complex structures. Prefer `cmp` for new code, and consider updating -older code to use `cmp` where practical. `reflect.DeepEqual` is sensitive to -changes in unexported fields and other implementation details. - -NOTE: The `cmp` package can also be used with protocol buffer messages, by -including the `cmp.Comparer(proto.Equal)` option when comparing protocol buffer -messages. - -## Got before Want - -Test outputs should output the actual value that the function returned before -printing the value that was expected. A usual format for printing test outputs -is "`YourFunc(%v) = %v, want %v`". - -For diffs, directionality is less apparent, and thus it is important to include -a key to aid in interpreting the failure. See [Print Diffs](#print-diffs). - -Whichever order you use in your failure messages, you should explicitly indicate -the ordering as a part of the failure message, because existing code is -inconsistent about the ordering. - -## Identify the Function - -In most tests, failure messages should include the name of the function that -failed, even though it seems obvious from the name of the test function. - -Prefer: - -```go -t.Errorf("YourFunc(%v) = %v, want %v", in, got, want) -``` - -and not: - -```go -t.Errorf("got %v, want %v", got, want) -``` - -## Identify the Input - -In most tests, your test failure messages should include the function inputs if -they are short. If the relevant properties of the inputs are not obvious (for -example, because the inputs are large or opaque), you should name your test -cases with a description of what's being tested, and print the description as -part of your error message. - -Do not use the index of the test in the test table as a substitute for naming -your tests or printing the inputs. Nobody wants to go through your test table -and count the entries in order to figure out which test case is failing. - -## Keep Going - -Even after your test cases encounter a failure, they should keep going for as -long as possible in order to print out all of the failed checks in a single run. -This way, someone who's fixing the failing test doesn't have to play -whac-a-mole, fixing one bug and then re-running the test to find the next bug. - -On a practical level, prefer calling `t.Error` over `t.Fatal`. When comparing -several different properties of a function's output, use `t.Error` for each of -those comparisions. - -`t.Fatal` is usually only appropriate when some piece of test setup fails, -without which you cannot run the test at all. In a table-driven test, `t.Fatal` -is appropriate -for failures that set up the whole test function before the test loop. Failures -that affect a single entry in the test table, which make it impossible to -continue with that entry, should be reported as follows: - -* If you're not using `t.Run` subtests, you should use `t.Error` followed by a - `continue` statement to move on to the next table entry. -* If you're using subtests (and you're inside a call to `t.Run`), then - `t.Fatal` ends the current subtest and allows your test case to progress to - the next subtest, so use `t.Fatal`. - -## Mark Test Helpers - -A test helper is a function that performs a setup or teardown task, such as -constructing an input message, that does not depend on the code under test. - -If you pass a `*testing.T`, call -[`t.Helper`](https://pkg.go.dev/testing#T.Helper) to attribute failures in the -test helper to the line where the helper is called. - -```go -func TestSomeFunction(t *testing.T) { - golden := readFile(t, "testdata/golden.txt") - // ... -} - -func readFile(t *testing.T, filename string) string { - t.Helper() - - contents, err := ioutil.ReadFile(filename) - if err != nil { - t.Fatal(err) - } - - return string(contents) -} -``` - -Do not use this pattern when it obscures the connection between a test failure -and the conditions that led to it. Specifically, `t.Helper` should not be used -to implement assert libraries. - -## Print Diffs - -If your function returns large output then it can be hard for someone reading -the failure message to find the differences when your test fails. Instead of -printing both the returned value and the wanted value, make a diff. - -Add some text to your failure message explaining the direction of the diff. - -Something like "`diff -want +got`" is good when you're using the `cmp` package -(if you pass `(want, got)` to the function), because the `-` and `+` that you -add to your format string will match the `+` and `-` that actually appear at the -beginning of the diff lines. - -The diff will span multiple lines, so you should print a newline before you -print the diff. - -## Table-Driven Tests vs Multiple Test Functions - -[Table-driven](https://github.com/golang/go/wiki/TableDrivenTests) tests should -be used whenever many different test cases can be tested using similar testing -logic, for example when testing whether the actual output of a function is equal -to the expected output [[example]](https://github.com/golang/go/wiki/TableDrivenTests#example-of-a-table-driven-test), -or when testing whether the outputs of a function always conform to the same set -of invariants. - -When some test cases need to be checked using different logic from other test -cases, it is more appropriate to write multiple test functions. The logic of -your test code can get difficult to understand when every entry in a table has -to be subjected to multiple kinds of conditional logic to do the right kind of -output check for the right kind of input. If they have different logic but -identical setup, a sequence of subtests within a single test function might -also make sense. - -You can combine table-driven tests with multiple test functions. For example, if -you're testing that a function's non-error output exactly matches the expected -output, and you're also testing that the function returns some non-nil error -when it gets invalid input, then the clearest unit tests can be achieved by -writing two separate table-driven test functions — one for normal non-error -outputs, and one for error outputs. - -## Test Error Semantics - -When a unit test performs string comparisons or uses `reflect.DeepEqual` to -check that particular kinds of errors are returned for particular inputs, you -may find that your tests are fragile if you have to reword any of those error -messages in -the future. Since this has the potential to turn your unit test into a -[change detector](https://testing.googleblog.com/2015/01/testing-on-toilet-change-detector-tests.html), -don't use string comparison to check what type of error your function returns. - -It's OK to use string comparisons to check that error messages coming from the -package under test satisfy some property, for example, that it includes the -parameter name. - -If you care about testing the exact type of error that your functions return, -you should separate the error string intended for human eyes from the -structure that is exposed for programmatic use. In this case, you should avoid -using `fmt.Errorf`, which tends to destroy semantic error information. - -Many people who write APIs don't care exactly what kinds of errors their API -returns for different inputs. If your API is like this, then it is sufficient to -create error messages using `fmt.Errorf`, and then in the unit test, test only -whether the error was non-nil when you expected an error. diff --git a/TestFailures.md b/TestFailures.md index e1add300..2ea61714 100644 --- a/TestFailures.md +++ b/TestFailures.md @@ -1,190 +1,4 @@ -# TestFailures +The Go wiki on GitHub has moved to go.dev (#61940). -If you notice a failure in a test in the Go project, what should you do? +Try or . -## Goals of testing - -The goal of writing (and running) tests for a Go package is to learn about the -behavior of that package and its dependencies. - -A test failure for a Go package may give us information about: -* implementation defects in the package or its dependencies, -* mistaken assumptions about the package API, -* bugs in the test itself (such as invalid assumptions about timing), -* unexpectedly high resource requirements (such as RAM or CPU time), or -* bugs in the underlying platform or defects in the test infrastructure (which - may need to be escalated or worked around). - -In some cases, the cause of a test failure might not be clear: it might be -caused by _more than one_ of the above conditions. Much like repeating a -scientific experiment, allowing a test to fail multiple times can sometimes -provide more information from the specific pattern of failures. - -However, if a test fails without telling us anything new, then the test is not -fulfilling its purpose. - -## Finding test failures - -A test failure is typically noticed from: -* the [Go build dashboard](https://build.golang.org), especially during [builder - triage](https://go.dev/issue/52653); -* TryBot or [SlowBot](https://go.dev/wiki/SlowBots) failures on a pending - change; -* running `go test` on a specific package or packages, either working within a - Go project repository or as part of (say) `go test all` in a user's own - module; -* or running `all.bash` or `all.bat` when [installing from - source](https://go.dev/doc/install/source#install) or [testing a contributed - change](https://go.dev/doc/contribute#testing). - -## Triaging a test failure - -Once we have noticed a failure, we need to _triage_ it. -The goal of triage is to identify: - -1. Is the information from the failure new? -2. Who is best equipped to analyze the new information from the failure? - -### Identifying new information - -Start by searching the [open issues](https://go.dev/issue) for key details from -the failure, such as the name of the failing test and/or other distinctive -fragments of the error text (such as error codes). - -If you find an existing issue, first check the issue discussion to see whether -the failure has already been fixed, and whether the information from your failure -contributes relevant new information. If so, _comment on it_ with details: -* describe what Go version you were testing (`go version`) -* how and where you were running the test, such as: - * `go env` output - * your machine and OS configuration - * your network configuration and status -* whether or how often you are able to reproduce the failure. - -Ideally, attach or link to the full test logs (possibly in a `
    ` block). - -If you don't find an existing issue, file a new one. - -### Filing an issue - -Paste in enough of the test log for future reporters to be able to search for -the issue, including the name of the test and any distinctive parts of its log -output. (If the test log is long — such as if it contains a large goroutine -dump — consider posting a shorter excerpt and/or enclosing the complete failure -message in a `
    ` block.) - -You can use the -[`fetchlogs`](https://pkg.go.dev/golang.org/x/build/cmd/fetchlogs) and -[`greplogs`](https://pkg.go.dev/golang.org/x/build/cmd/greplogs) tools to -search for similar failures in the build dashboard: - -``` -# download recent logs -fetchlogs -n 1024 -repo all -``` -``` -# search logs for some regexp describing the failure message -greplogs -l -e $FAILURE_REGEXP -``` - -If the failure appears to be specific to a package, consult -https://dev.golang.org/owners to find the maintainers of that package and mention -them on the issue. (If no owners are listed for the package, check the recent -history of the package at https://cs.opensource.google/go and/or escalate to -someone who can help to identify a relevant owner — and consider updating the -[owners -table](https://cs.opensource.google/go/x/build/+/master:devapp/owners/table.go) -with what you learn!) - -If the failure appears to be specific to a `GOOS` or `GOARCH` label the issue -with the corresponding GOOS and/or GOARCH labels, and mention the relevant -subteam(s) of -[@golang/port-maintainers](https://github.com/orgs/golang/teams/port-maintainers) -on the issue. - -If the failure appears to affect at least one -[first class port](https://go.dev/wiki/PortingPolicy#first-class-ports), -add the issue to the current release milestone and label it -[`release-blocker`](https://github.com/golang/go/labels/release-blocker). -Otherwise, add the issue to the `Backlog` milestone. - -If the failure appears to be specific to a builder (such as a network -connectivity issue, or a platform bug requiring a system update), consult -[`x/build/dashboard/builders.go`](https://cs.opensource.google/go/x/build/+/master:dashboard/builders.go) -to find the maintainer for that builder and mention them on the issue. -(For builders without an explicit maintainer listed, instead mention -the [@golang/release](https://github.com/orgs/golang/teams/release) team.) - -## Addressing a test failure - -Once an issue has been filed for a test failure, the relevant package, port, -and/or builder maintainers should examine the information gleaned from the test -failure and decide how to _address_ it, by doing one or more of: - -* _revert_ a change to the code or the test infrastructure believed to have - introduced the problem, -* _fix_ (or apply a workaround for) the root cause of the failure, -* _collect_ more information, by subscribing to issue updates and/or running - more tests, -* _report_ an underlying defect in a dependency, platform, or test - infrastructure, and/or -* _deprioritize_ the failure, by skipping the failure on affected platforms (or - marking those platforms as broken) and then moving the issue to a future or - `Backlog` milestone and/or removing the `release-blocker` label. - -When a maintainer decides to deprioritize a test failure, they determine that -_additional failures of the test will not provide useful new information_. At -that point, the test no longer fulfills its purpose, and the maintainer should -suppress the failure — typically by adding a call to -[`testenv.SkipFlaky`](https://pkg.go.dev/internal/testenv#SkipFlaky) or -[`t.Skipf`](https://pkg.go.dev/testing#F.Skipf). - -### Skipping a test failure - -When we add a call to `testenv.SkipFlaky`, our goal is to eliminate failure -modes that do not provide new information while still preserving as much of the -value of the test as is feasible. - -* If the observed failure is only one of several possible failure modes for - the test, skip the test only for that failure mode. - - * For example, if the error is always something specific like - `syscall.ECONNRESET`, use `errors.Is` to check for that specific error. - -* If the failure is believed to affect all versions of a particular `GOOS` - and/or `GOARCH`, or the affected versions cannot be identified, check against - `runtime.GOOS` and/or `runtime.GOARCH` and skip only the affected platform. - -* If the failure is due to a bug on a _specific version_ of a platform, skip the - test based on `testenv.Builder` or the `GO_BUILDER_NAME` environment variable. - (If the test fails for external Go users, they have the option to upgrade to - an unaffected version of the platform — and they probably ought to see the - test failure to find out that the bug exists!) - - * Also consider adding another environment variable that users and contributors - can set to acknowledge the bug and suppress the failure. - -### Marking a builder or port as broken - -A platform bug or bug in a core package (such as `os`, `net`, or `runtime`) may -impact so many tests that the failures are not feasible to skip, or may manifest -as a failure at compile or link time. If such a bug occurs, the options are more -limited: if we cannot revert a change or fix or work around the root cause, and -don't need to collect more information, we can only deprioritize the failure by -marking the _entire builder or platform_ as broken. - -To mark a builder as broken, edit its configuration in -[`x/build/dashboard/builders.go`](https://cs.opensource.google/go/x/build/+/master:dashboard/builders.go) -to add an issue in the `KnownIssue` field; note that builders with known issues -will generally be skipped during dashboard triage. - -A broken builder for a -[first class port](https://go.dev/wiki/PortingPolicy#first-class-ports) -should have its known issue(s) labeled `release-blocker`, pending a decision -to either fix the builder or drop support for the affected version of the -platform. - -If all of the builders for a secondary port are broken, the port itself may be -considered broken. [Discussion -#53060](https://github.com/golang/go/discussions/53060) -aims to resolve the question of how broken secondary ports should be handled. \ No newline at end of file diff --git a/Timeouts.md b/Timeouts.md index 7fb02361..fff366ea 100644 --- a/Timeouts.md +++ b/Timeouts.md @@ -1,25 +1,4 @@ -# Timeouts and Deadlines +The Go wiki on GitHub has moved to go.dev (#61940). -To abandon synchronous calls that run too long, use the select statement with time.After: -```go -import "time" +Try or . -c := make(chan error, 1) -go func() { c <- client.Call("Service.Method", args, &reply) } () -select { - case err := <-c: - // use err and reply - case <-time.After(timeoutNanoseconds): - // call timed out -} -``` - -Note that the channel ` c ` has a buffer size of 1. If it were an unbuffered channel and the client.Call method took more than ` timeoutNanoseconds `, the channel send would block forever and the goroutine would never be destroyed. - -## References - -time.After: https://pkg.go.dev/time/#After - -select: https://go.dev/ref/spec#Select_statements - -blog post: https://go.dev/blog/2010/09/go-concurrency-patterns-timing-out-and.html \ No newline at end of file diff --git a/Training.md b/Training.md index 444bbcaa..7015f10e 100644 --- a/Training.md +++ b/Training.md @@ -1,33 +1,4 @@ -Commercial providers of Go training +The Go wiki on GitHub has moved to go.dev (#61940). -## On-line +Try or . -* [Go Mastery](https://qvault.io/go-mastery-course/) - Interactive browser-based coding course focused on teaching Go's quirks and syntax -* [Golang Online Courses](https://classpert.com/go-programming) - A collection of Go online courses from several providers -* [Mastering Go Programming](https://www.packtpub.com/application-development/mastering-go-programming-video) - A comprehensive Go video training course -* [Golang Tutorials - Sathish VJ](http://golangtutorials.blogspot.com/2011/05/table-of-contents.html) - A free online class. -* [Learn Go - Codementor.io](https://www.codementor.io/go) - Beginner level online class. -* [Learning to Program in Go - Chris Hawkes](https://www.youtube.com/playlist?list=PLei96ZX_m9sVSEXWwZi8uwd2vqCpEm4m6) - Free video tutorial for beginner Go programming. -* [Go - Progate.com](https://progate.com/languages/go) - Go fundamentals for absolute beginners. -* [Go Language Programming Practical Basics Tutorial - Sentdex](https://www.youtube.com/playlist?list=PLQVvvaa0QuDeF3hP0wQoSxpkqgRcgxMqX) - Free video tutorial for Go beginners by Sentdex. -* [O'Reilly Go Fundamentals](http://shop.oreilly.com/category/learning-path/go-fundamentals.do) - Video training series. -* [Pluralsight.com](http://www.pluralsight.com/tag/golang) - Offers around 20 classes from beginner to advanced levels. -* [Master Go](https://appliedgo.com/courses/mastergo) - A paid online video course on Go for developers -* [Learn to Create Web Applications using Go](https://www.usegolang.com/) - A paid online video course and book about Web programming with Go -* [Golang tutorial](https://hackr.io/tutorials/learn-golang) - Learn Go from the best online golang tutorials submitted & voted by the golang programming community. -* [Ultimate Go Live Lessons](http://www.informit.com/store/ultimate-go-programming-livelessons-9780134757483) - This is Ardan Labs classroom Go training on video. -* [Go: The Complete Bootcamp Course](https://www.udemy.com/learn-go-the-complete-bootcamp-course-golang/?couponCode=GOWIKI) - Learn to build real-world and idiomatic Go programs with animated video lectures and hands-on exercises -* [Learn Go with Tests](https://quii.gitbook.io/learn-go-with-tests/) - Free Test driven development (TDD) based learning of Golang. Start writing robust, well-tested systems in Go - -## Classroom and In-Person - -* [Ardan Labs](https://www.ardanlabs.com/) - Offering customized on-site live training classes. -* [Bitfield Consulting](https://bitfieldconsulting.com/go-mentoring) - John Arundel offers remote training and mentoring in Go for individuals and companies. -* [Boss Sauce Creative](https://bosssauce.it/services/training) - Personalized or track-based Go training for teams. -* [Brian Ketelsen](https://www.brianketelsen.com/) - In-person, remote, and online training classes for individuals and companies. -* [DevelopIntelligence: Golang Intro + Advanced](https://www.developintelligence.com/) - Custom in-person and virtual training for corporate clients. -* [Golang At Speed](https://golangatspeed.com) - Generic or personalized Go training. On-site or hosted off-site. Grasp the long-tail of Golang learning.... the gotchas and the quirky idioms.. faster. -* [Gopher Guides](https://www.gopherguides.com/) - Customized In-person, remote, and online training classes. Training for Developers by Developers. Lead Instructors: [Mark Bates](http://www.gopherguides.com/team/mark.bates), [Cory LaNou](http://www.gopherguides.com/team/cory.lanou) -* [Shiju Varghese](https://github.com/shijuvar/gokit/blob/master/training/README.md) - On-site class room training on Go, and consulting on building distributed systems and Microservices with Go, in India. -* [Magesh Kuppan](https://www.linkedin.com/in/tkmagesh) - Classroom & Online training on Go Programming & Building Microservices in Go -* [kkoehler](https://golang.kkoehler.com) - In-Person class trainings for Go in Germany, Austria and Swiss \ No newline at end of file diff --git a/Ubuntu.md b/Ubuntu.md index 45443a54..eda6103c 100644 --- a/Ubuntu.md +++ b/Ubuntu.md @@ -1,35 +1,4 @@ -> The Go project's official download page is at [https://go.dev/dl](https://go.dev/dl/). -> -> After downloading a binary release suitable for your system, you can install go by following the official installation instructions at [https://go.dev/doc/install](https://go.dev/doc/install#install). +The Go wiki on GitHub has moved to go.dev (#61940). -There are some other options for Debian based systems like Ubuntu. These packages were not created by the Go project, and we don't support them, but they may be useful for you. +Try or . -## Using PPA - -If you're using Ubuntu 18.04, 20.04 or 22.04 (amd64, arm64 or armhf), then you can use the [longsleep/golang-backports PPA](https://launchpad.net/~longsleep/+archive/ubuntu/golang-backports) and update to Go 1.21. - -``` -sudo add-apt-repository ppa:longsleep/golang-backports -sudo apt update -sudo apt install golang-go -``` - -> **Note that `golang-go` installs latest Go as default Go. If you do not want that, install `golang-1.21` instead and use the binaries from `/usr/lib/go-1.21/bin`.** - -## Using snap - -Using [snaps](https://snapcraft.io/go) also works quite well. - -``` -sudo snap install --classic go -``` -> A restart may or may not be required for the command to be recognized depending on your system. - -## Using getgo - -Using [getgo](https://github.com/golang/tools/tree/master/cmd/getgo) (proof-of-concept command-line installer for Go). - -``` -curl -LO https://get.golang.org/$(uname)/go_installer && chmod +x go_installer && ./go_installer && rm go_installer -``` -> Getgo will install the Go distribution (tools & stdlib) to "/.go" inside your home directory. diff --git a/Watchflakes.md b/Watchflakes.md index 6987011c..7cb66a27 100644 --- a/Watchflakes.md +++ b/Watchflakes.md @@ -1,179 +1,4 @@ -Watchflakes is a program that triages apparent test flakes on the build.golang.org dashboards. +The Go wiki on GitHub has moved to go.dev (#61940). -An apparent test flake is a failure that: +Try or . - - is not on a completely failing builder. - - is not on an [excluded builder](https://go.dev/issue/55166). - - is not running a commit that failed on 4 or more builders. - - is not part of a run of 4 or more failing commits on its builder. - -Watchflakes posts every apparent test flake to an issue in the [Test Flakes project](https://github.com/orgs/golang/projects/20). - -Every issue description in the Test Flakes project starts with a pattern for the failures relevant to that issue: -For example, the markdown for #55260's description starts with: - - ``` - #!watchflakes - post <- pkg == "cmd/go" && test == "" && `unexpected files left in tmpdir` - ``` - -Watchflakes matches every apparent test flake against the patterns in the issues: - - - If a flake matches a pattern in an issue, it is posted to that issue. - - If a flake matches a pattern in multiple issues, it is posted to the lowest-numbered issue. - - If a flake does not match a pattern in any issue, watchflakes creates a new issue with a pattern matching the package and test case that failed. - -The newly created issue's pattern is often too broad and should be edited to make it more specific to the actual failure. -Sending a failure to the lowest-numbered matching issue ensures that creating a broad default pattern -for a new failure does not “steal” failures from earlier issues, -nor does it spam the new issue with unrelated failures in the same test that are already separately tracked. - -Watchflakes places newly created issues in the Test Flakes project and adds the NeedsInvestigation label. -These issues start out with no status (not Active, not Done). -Issues with no status need to be inspected by a person, -who should usually refine the pattern to capture the salient information about the failure. -Issues that have been checked can then be moved to Active. -GitHub automatically moves issues from Active to Done when they are closed. - -Watchflakes considers issues of any status when matching a new failure. -If it finds a new failure for a closed issue, it will post the failure and reopen the issue. -So it is okay to close an issue when a fix lands, instead of having to wait a few weeks -to see if the failure is really gone: if a new failure arrives, the issue will be reopened automatically. - -Watchflakes maintains no state of its own: all the state is in the GitHub issues. -Every time it runs, it considers the past 60 days of build dashboard failures -and makes sure that every apparent flake is accounted for in the Test Flakes project. -If a failure matching an issue has already been posted to that issue, watchflakes doesn't post it again, of course. -And if an issue is edited to update its pattern to exclude certain failures, -watchflakes doesn't remove its old posts, but it does look for a different matching issue for those failures, -including possibly creating a new one. - -## Syntax - -The watchflakes stanza in each issue must appear at the top of the issue description. -It must be a code block (either fenced with ```` ``` ```` or indented), and the first line must be `#!watchflakes`, -to keep watchflakes from misinterpreted unrelated code blocks. - -The rest of the block is a small watchflakes script. Comments to the end of the line are introduced with `#`. -The script is a sequence of rules, each of which has the form `action <- pattern` -(send matches for pattern to the action). - -### Actions - -The actions are: - - - `post` posts the failure to the issue in which the script appears. - - `skip` ignores the failure, throwing it on the floor. This action should be used only rarely (for example, to set policy like in #55166). - - `default` is a lower-priority version of post. If an issue has a `post` or `skip` matching the failure, watchflakes does that instead. - But if there are no other matches, watchflakes considers the `default` pattern matches. - (And then if there aren't any `default` matches, watchflakes creates a new issue.) - -### Records - -The input to the pattern is a record with named fields, each of which has a string value: - - - `pkg` is the full import path of the package that failed to build or that failed its test. - - - `test` is the name of the test function in the package that failed. - - - `mode` is `build` or `test` depending on whether this is a build failure or a test failure. - - - `output` is the output from the failing test. This output stops just before the final `FAIL` line printed when the test binary exits. - It does not include output from other test cases that also failed in the same run, - nor any context that was printed by all.bash or the buildlet before the test started. - - - `log` is the entire failed build log. - - - `snippet` is the shortened form of `output` that will be posted to the issue itself. - Matches should almost always use `output` instead. - - - `builder` is the name of the builder that ran the test (like `dragonfly-amd64-622`). - - - `repo` is the name of the repo being tested (`go`, `net`, `tools`, ...). - - - `goos` is the GOOS value (`linux`, `windows`, ...). - - - `goarch` is the GOARCH value (`amd64`, `mips64le`, ...). - - - `date` is the date of the commit being tested, in the form `2006-01-02T15:04:05`. - There is no date comparison logic; use string comparisons instead. - Comparing dates should be used rarely. - - - `section` is the section of the build log in which the failure occurred. - In all.bash output, the section is introduced by `#####`, - and each of the `Building` lines during bootstrap is considered its own section as well. - In subrepos, the `:: Running` lines each introduce a section named for the go command being run - (for example `go test golang.org/x/tools/...`). - - Most patterns don't need to use `section`. It is most helpful for tests in the main repo - that rerun tests with an alternate execution environment. - -### Patterns - -The pattern is a boolean expression in a Go-like syntax allowing -||, &&, !, (, and ) for building complex expressions; -==, !=, <, <=, >, and >= for comparing fields against against string literals; -and ~ and !~ for matching against regular expressions. - -All string comparisons must have a field name on the left and a double-quoted string literal on the right, as in -`builder == "linux-amd64-alpine"` or `goos == " - -All regular expression matches must have a field name on the left and a back-quoted string literal on the right, as in -`` builder ~ `corellium` ``. - -A back-quoted string literal by itself is taken to be a comparison against the `output` field, -which is appropriate for the vast majority of regular expressions in patterns. - -## Examples - -Putting this all together, here are some example scripts. - - #!watchflakes - post <- pkg == "net/http" && test == "TestHandlerAbortRacesBodyRead" - -This script in #55277 was created automatically by watchflakes in response -to a build run that failed in http.TestHandlerAbortRacesBodyRead. -The specific failure that prompted the issue creation was a timeout. -If more failures with different root cause were found in that test, it might become -appropriate to add `` && `panic: test timed out` `` or otherwise refine the pattern. - - #!watchflakes - post <- goos == "openbsd" && `unlinkat .*: operation not permitted` - -This script in #49751 collects failures on openbsd caused by unexpected EPERM -errors from os.Remove calling unlinkat. These failures cause problems in a variety of tests, -so there is no condition on `pkg` or `test`. - - #!watchflakes - post <- pkg ~ `^cmd/go` && `appspot.com.*: 503` - -This script in #54608 tracks network problems with 503 responses from appspot.com -in any tests in the cmd/go/... package hierarchy, not just cmd/go itself. - - #!watchflakes - post <- goos == "windows" && - (`dnsquery: DNS server failure` || `getaddrinfow: This is usually a temporary error`) - -This script in #55165 matches specific DNS failures in any test on builders running Windows. - - #!watchflakes - post <- builder == "darwin-arm64-12" && pkg == "" && test == "" - -This script in #55312 was created automatically by watchflakes to track failures on -the darwin-arm64-12 builder that happen before a specific package test can run. - - #!watchflakes - # note: sometimes the URL is printed with one / - default <- `(Get|read) "https://?(goproxy.io|proxy.golang.com.cn|goproxy.cn)` - -This script in #55163 matches errors using certain non-standard Go proxies. -It uses `default` to allow other issues to take ownership of more specific failures caused by these proxies. -Failures not matching other issues go to #55163 instead of creating new issues. - - #!watchflakes - default <- `: internal compiler error:` - -This script in #55257 matches compiler failures in any build, no matter what package or repo is being tested. -It uses `default` for the same reasons as the previous example: so that issues matching specific -compiler errors can still be filed, but failures not matching other issues are grouped into #55257 -instead of creating new issues assigned to the specific test that happened to trigger the problem. diff --git a/WebAccessibilityResourcesAndTips.md b/WebAccessibilityResourcesAndTips.md index 4e48ca7a..6bcdc41b 100644 --- a/WebAccessibilityResourcesAndTips.md +++ b/WebAccessibilityResourcesAndTips.md @@ -1,40 +1,4 @@ -Accessibility or "a11y" is an increasingly important topic in web development. It is important to Go because many Go tools and resources use web technology, like godoc. Ensuring that these tools are accessible ensures that more people can use them and that more people can use Go. +The Go wiki on GitHub has moved to go.dev (#61940). -Accessibility is a large topic that ranges from the merely esoteric to the excruciatingly abstruse. +Try or . -There are, however, a number of simple rules of thumb to follow that greatly reduce the chances of creating an inaccessible page by accident: -- Prefer semantic markup. The native html elements have a great deal of accessibility baked in with no need to turn anything on or turn anything off. If you have a list of things use `ul` or `ol` even if you do not want it to be displayed as a list. The extra CSS is worth it. -- When using headers (`h1`-`h6`) never skip a level and make sure they nest logically so that, for example, an `h4` is a logical subsection of the previous `h3`. Screen readers use these as navigational landmarks, similar to a table of contents. -- Avoid layouts that work against the source order of the document. It's very easy to rearrange element with flexbox and grid but when you do the focus order remains unchanged. Someone navigating the site by keyboard will jump from place to place seemingly at random, making it very hard to follow what's going on. -- Ensure sufficient color contrast. Not everyone has perfect eyes or high quality displays. Either can make it difficult to tell where low-contrast content starts and stops. https://leaverou.github.io/contrast-ratio/ -- Ensure the page is usable without color. There are many kinds of color deficiency. Some like red-green color blindness are common. Others can be quite rate. The best way to make sure everyone gets the same information is to encode information in both shape and color. For example, if you're making a dashboard for a test runner do not just have a green circle for passed and a red circle for failed: have a green check mark for passed and a red X for failed. -- Have clear hover and focus styles to let the user know that an element is "clickable". As with the above, this should be clear even without color. -- Make sure nothing breaks as you zoom in the page to 200%. Browsers are really good about handling this but are not always perfect. Users with poor vision will appreciate the effort. -- Make sure the page is usable entirely by keyboard. Certain medical conditions make it hard to use a mouse or trackpad and a lot of special assistive software and hardware work by creating synthetic key events. Be very careful about elements hidden off page as they will remain in the focus order without special effort. -- Ensure all non-textual elements have appropriate alternative text. (If a non-textual item is purely decorative the appropriate alternative text is the empty string.) -- Avoid writing in ALL CAPS. Screen readers will always read this as an acronym and spell out each letter (`text-transform: uppercase` is fine, however, and will just add emphasis to the voice). -- There are a lot of tools to help find accessibility problems (some listed below) but keep in mind that these are just linters and there are limits to static analysis. They sometimes have false positives and often have false negatives. Also keep in mind that what they are checking is the page as it appears when you run the tool. - -# Useful Browser Extensions - -## Firefox - -- [Fangs](https://addons.mozilla.org/en-US/firefox/addon/fangs-screen-reader-emulator/) is a screen reader emulator. It dumps all the info a screen reader would announce at once as annotated text, allowing a very quick review. - -## Chrome - -Chrome has some quite useful built in a11y tools, but you need to enable them by going to settings > experiments in the dev tools and checking "Accessibility Inspection". - -- [Google's Accessibility Developer Tools](https://chrome.google.com/webstore/detail/accessibility-developer-t/fpkknkljclfencbdbgkenhalefipecmb) Largely integrated into the Chrome dev tools but still has some features not yet included like access to the full Accessibility Tree. -- [aXe](https://chrome.google.com/webstore/detail/axe/lhdoppojpmngadmnindnejefpokejbdd) Decent static analyzer. It's the basis for the accessibility audit in Chrome Dev tools but this extension includes much more information and runs more tests. (Also available for Firefox, but has much better integration in Chrome). -- [ChromeVox](https://chrome.google.com/webstore/detail/chromevox/kgejglhpjiefppelpmljglcjbhoiplfn) A full in-browser screen reader. (You will need to configure keyboard shortcuts to be able to turn it off when not in use, and you may also need to disable the extension completely when not in use as it can do some annoying thing even when not active). -- [High Contrast](https://chrome.google.com/webstore/detail/high-contrast/djcfdncoelnlbldjfhinnjlhdjlikmph) This extension is used by people with special contrast needs. It's a good idea to run a page through each filter (and test any hover/focus states) to make sure that everything is still visible. -- [Siteimprove Accessibility Checker](https://chrome.google.com/webstore/detail/siteimprove-accessibility/efcfolpjihicnikpmhnmphjhhpiclljc) This is the best static auditor. The extension will ask you to register for a newsletter on first use, but you do not have to—just skip it. -- [Spectrum](https://chrome.google.com/webstore/detail/spectrum/ofclemegkcmilinpcimpjkfhjfgmhieb) Simulates various kinds of color blindness to make sure nothing on the page becomes invisible or hard to distinguish when read by a user with that specific medical condition. (For some reason this does not seem to work immediately after installation but it will after a few retries). -- [Funkify](https://chrome.google.com/webstore/detail/funkify-disability-simula/ojcijjdchelkddboickefhnbdpeajdjg) An easy to use disability simulator. - -# Further Reading -- http://a11yproject.com/ -- https://inclusive-components.design/ -- https://accessibility.blog.gov.uk/ -- https://www.youtube.com/playlist?list=PLNYkxOF6rcICWx0C9LVWWVqvHlYJyqw7g \ No newline at end of file diff --git a/Well-known-struct-tags.md b/Well-known-struct-tags.md index bb5ca5eb..3482bff3 100644 --- a/Well-known-struct-tags.md +++ b/Well-known-struct-tags.md @@ -1,51 +1,4 @@ -# Well-known struct tags -## Background +The Go wiki on GitHub has moved to go.dev (#61940). -Go offers [struct tags](https://go.dev/ref/spec#Tag) which are discoverable via reflection. These enjoy a wide range of use in the standard library in the JSON/XML and other encoding packages. - -The community welcomed them and has built ORMs, further encodings, flag parsers and much more around them since, especially for these tasks, single-sourcing is beneficial for data structures. - -## Problem description -Due to increased usage of Go and thus Go [struct tags](https://go.dev/ref/spec#Tag), clashes become inevitable. - -## Solution -The list below is a best effort to document well-known struct tags used by packages which are available to the public. - -## Format of the list -* Struct tag as extracted by calling https://pkg.go.dev/reflect#StructTag.Get with this tag as the `key` argument. -* Documentation link of this package using https://pkg.go.dev - -### Example entry -Tag | Documentation -----|----- -xml | https://pkg.go.dev/encoding/xml - -### Change Management -List entries can be added by anyone who creates a public package where a new tag is used. -List entries can be removed when the links to the package documentation stops working or the author(s) of that package requests it. - -## List of well-known struct tags -Tag | Documentation -----------|--------------- -xml | https://pkg.go.dev/encoding/xml -json | https://pkg.go.dev/encoding/json -asn1 | https://pkg.go.dev/encoding/asn1 -reform | https://pkg.go.dev/gopkg.in/reform.v1 -dynamodbav | https://docs.aws.amazon.com/sdk-for-go/api/service/dynamodb/dynamodbattribute/#Marshal -bigquery | https://pkg.go.dev/cloud.google.com/go/bigquery -datastore | https://pkg.go.dev/cloud.google.com/go/datastore -spanner | https://pkg.go.dev/cloud.google.com/go/spanner -bson | https://pkg.go.dev/go.mongodb.org/mongo-driver/bson -gorm | https://pkg.go.dev/github.com/jinzhu/gorm -yaml | https://pkg.go.dev/gopkg.in/yaml.v2 -toml | https://pkg.go.dev/github.com/pelletier/go-toml -validate | https://github.com/go-playground/validator -mapstructure | https://pkg.go.dev/github.com/mitchellh/mapstructure -parser | https://pkg.go.dev/github.com/alecthomas/participle -protobuf | https://github.com/golang/protobuf -db | https://github.com/jmoiron/sqlx -url | https://github.com/google/go-querystring -feature | https://github.com/nikolaydubina/go-featureprocessing -graphql | https://github.com/samsarahq/thunder -egg | https://github.com/andrewwphillips/eggql +Try or . diff --git a/WhyGo.md b/WhyGo.md index 22b2e8aa..f14e70b1 100644 --- a/WhyGo.md +++ b/WhyGo.md @@ -1,81 +1,4 @@ -Here's why: a list of people/organizations explaining why they use Go. This is partly redundant with [GoUsers](GoUsers). We also have a specific page dedicated to [Go success stories](SuccessStories). +The Go wiki on GitHub has moved to go.dev (#61940). -## Why Go +Try or . -- [Why Devops Engineers Should Know Go](https://akondas.com/blog/Why-DevOps-Engineers-Should-Know-Go) _2020-05-27_ -- [Why We Chose Go](https://tech.trivago.com/2020/03/02/why-we-chose-go/) _2020-03-02_ -- [Why Go? – Key advantages you may have overlooked](https://yourbasic.org/golang/advantages-over-java-python/) _2019-06-01_ -- [From Java to Go](https://gquintana.github.io/2017/01/15/From-Java-to-Go.html) _2017-01-15_ -- [Why should you learn Go](https://medium.com/@kevalpatel2106/why-should-you-learn-go-f607681fad65#.qu6he77fy) _2017-01-08_ -- [Moving a team from Scala to Go](http://jimplush.com/talk/2015/12/19/moving-a-team-from-scala-to-golang/) _2015-12-19_ -- [For Better or For Worse](http://jmoiron.net/blog/for-better-or-for-worse/) _2015-11-12_ -- [Six reasons why I love Go](http://jbu.io/2015/10/28/six-reasons-why-i-love-go/) _2015-10-28_ -- [CERN: Python vs Go for Data Access Service (PDF)](https://indico.cern.ch/event/449425/session/1/contribution/6/attachments/1168560/1685802/DAS_python_vs_go.pdf) _2015-10-18_ -- [Sorry Ruby, I think I've fallen for Go](https://medium.com/@voxxit/sorry-ruby-i-think-i-ve-fallen-for-go-2e92ce1b356) _2015-09-26_ -- [Moving to Three Languages](https://jaredwray.com/blog/moving-to-three-languages/) _2015-09-15_ -- [Warming up to Go](http://jeremymikkola.com/posts/2015_08_28_warming_up_to_go.html) _2015-08-28_ -- [400 Days of Go](http://www.philipotoole.com/400-days-of-go/) -- [Iron.io: How We Went from 30 Servers to 2 with Go](http://blog.iron.io/2013/03/how-we-went-from-30-servers-to-2-go.html) -- [Juju at Canonical](http://www.reddit.com/r/programming/comments/18atce/juju_canonical_109k_lines_of_go_code/) -- [Go at bitly](http://word.bitly.com/post/29550171827/go-go-gadget) -- [NSQ: realtime distributed message processing at scale](http://word.bitly.com/post/33232969144/nsq) -- [CloudFlare blows hole in laws of Web physics with Go and Railgun](http://arstechnica.com/information-technology/2013/02/cloudflare-blows-hole-in-laws-of-web-physics-with-go-and-railgun/) -- [Why I Like Go](https://gist.github.com/freeformz/4746274) -- [dl.google.com now served by Go](https://groups.google.com/forum/?fromgroups=#!topic/golang-nuts/BNUNbKSypE0) -- [Rob Pike: Why Learn Go?](http://www.youtube.com/watch?v=FTl0tl9BGdc) -- [Why I went from Python to Go (and not node.js)](http://jordanorelli.tumblr.com/post/31533769172/why-i-went-from-python-to-go-and-not-node-js) -- [@derekcollison](http://twitter.com/derekcollison): ["Prediction: Go will become the dominant language for systems work in IaaS, Orchestration, and PaaS in 24 months."](https://twitter.com/derekcollison/status/245522124666716160) -- [Will Go be the new go-to programming language?](http://gigaom.com/cloud/will-go-be-the-new-go-to-programming-language/) -- [Dr. Dobb's: Why Not Go?](http://www.drdobbs.com/open-source/why-not-go/240005062) -- [Google I/O 2012: Go in production](http://www.youtube.com/watch?v=kKQLhGZVN4A) -- [Go at Novartis](http://web.archive.org/web/20181201020426/https://plus.google.com/114945221884326152379/posts/d1SVaqkRyTL) -- [Go at the BBC](http://www.quora.com/Go-programming-language/Is-Google-Go-ready-for-production-use/answer/Kunal-Anand) -- [Go at SoundCloud](https://developers.soundcloud.com/blog/go-at-soundcloud) -- [Go at Moovweb](https://groups.google.com/forum/#!topic/golang-nuts/MeiTNnGhLg8/discussion) -- [Building StatHat with Go](https://go.dev/blog/2011/12/building-stathat-with-go.html) -- [Go at CloudFlare](http://blog.cloudflare.com/go-at-cloudflare) -- [Why you PHP guys should learn Golang](http://www.mikespook.com/2012/08/why-you-php-guys-should-learn-golang/) -- [I/O BootCamp 2011: Real World Go](http://www.youtube.com/watch?v=7QDVRowyUQA) -- [Go at Heroku](https://go.dev/blog/2011/04/go-at-heroku.html) -- [**The Business Benefits of Building Your Next Project With Go** by Tom Maiaroto](https://medium.com/@shift8creative/the-business-benefits-of-building-your-next-project-with-go-ebed4bbc3ed7) -- [**TweetQureet: a full Golang technology stack** by Qureet](http://www.qureet.com/blog/golang-technology-stack/) -- [**Where and why we use Go** by Jeremey Bingham, Raintank.io](https://blog.raintank.io/where-and-why-we-use-go/) -- [*Half a decade with Go* by golang.org blog](https://go.dev/blog/5years) -- [**Why Learn Go** by Rob Pike (YouTube)](https://www.youtube.com/watch?v=FTl0tl9BGdc) -- [**Go at Google** by Rob Pike (YouTube)](http://www.infoq.com/presentations/Go-Google) -- [**Go at Google** by Rob Pike (Article)](http://talks.golang.org/2012/splash.article) -- [**5 things I love** by Andrew Gerrand (dotGo 2014)](https://www.youtube.com/watch?v=fsTOOPB1TBY) -- [**dl.google.com powered by Go** by Brad Fitzpatrick](http://talks.golang.org/2013/oscon-dl.slide#1) -- [*Is Google using Go internally?* by golang.org](https://go.dev/doc/faq#Is_Google_using_go_internally) -- [**The State of the Gopher** by Brad Fitzpatrick (dotGo 2014)](https://www.youtube.com/watch?v=4KFTacxqkcQ) -- [*Software I'm excited about* by Brad Fitzpatrick (dotScale 2013)](https://www.youtube.com/watch?v=sYukPc0y_Ro) -- [*I came for the easy concurrency I stayed for the easy composition* by John Graham-Cumming (dotGo 2014)](https://www.youtube.com/watch?v=4KFTacxqkcQ) -- [**Go 1.4+ Garbage Collection (GC) Plan and Roadmap** by Richard L. Hudson](https://docs.google.com/document/d/16Y4IsnNRCN43Mx0NZc5YXZLovrHvvLhK_h0KN8woTO4/edit) -- [*Five things that make Go fast* by Dave Cheney](http://dave.cheney.net/2014/06/07/five-things-that-make-go-fast) -- [*Another go at the Next Big Language* by Dave Cheney](http://dave.cheney.net/2012/09/03/another-go-at-the-next-big-language) -- [*Rewriting a large production system in Go* by Matt Welsh](http://matt-welsh.blogspot.com/2013/08/rewriting-large-production-system-in-go.html) -- [*Go is Boring* by Steve Bate](http://stevebate.silvrback.com/go-is-boring) -- [**Gopher Academy Blog**](http://blog.gopheracademy.com/) - - [*Kubernetes + Go = Crazy Delicious* by Joe Beda](http://blog.gopheracademy.com/birthday-bash-2014/kubernetes-go-crazy-delicious/) - - [*Why InfluxDB is written in Go* by Paul Dix](http://blog.gopheracademy.com/birthday-bash-2014/why-influxdb-uses-go/) - - [*How Continuum ended up being written in Go* by Derek Collison](http://blog.gopheracademy.com/birthday-bash-2014/apcera/) - - [**Building Street Address Autocomplete with Go** by Matt Holt](http://blog.gopheracademy.com/birthday-bash-2014/building-street-address-autocomplete/) -- [*Why I went from Python to Go (and not node.js)* by Jordan Orelli](http://jordanorelli.com/post/31533769172/why-i-went-from-python-to-go-and-not-node-js) -- [*Farewell Node.js* by TJ Holowaychuk](https://medium.com/code-adventures/farewell-node-js-4ba9e7f3e52b) -- [*Can Go really be that much faster than Python?* on StackOverflow](http://stackoverflow.com/questions/12574909/can-go-really-be-that-much-faster-than-python) -- [*Python to Go* by Weng Wei](http://www.slideshare.net/wuvist1/python-to-go) -- [*Why I Program in Go* by Tahir Hashmi](http://tech.t9i.in/2013/01/why-program-in-go/) -- [*DNS Server in Go* by Ask Bjørn Hansen](http://news.ntppool.org/2012/10/new-dns-server.html) -- [*Go and Swift* by Scott Rosenberg](https://medium.com/backchannel/my-computer-language-is-better-than-yours-58d9c9523644) -- [*Features I Like about Go* by Abhi Yerra](https://medium.com/on-being-a-code-monkey/things-i-like-about-go-e026762be8ac) -- [**From Python to Go translation of a large codebase** - Go translation of Reposurgeon](https://gitlab.com/esr/reposurgeon/blob/master/GoNotes.adoc) - -## Who uses Go - -[Moved to the GoUsers page](GoUsers) - - -## Benchmarks -- [**Express vs Flask vs Go vs Sparkjava** by Bijan](https://medium.com/@tschundeee/express-vs-flask-vs-go-acc0879c2122) -- [**Comparing the Performance of Various Web Frameworks** by Abel Avram](http://www.infoq.com/news/2014/05/benchmark-web-framework) -- [TechEmpower Web Framework Benchmarks](http://www.techempower.com/benchmarks/) diff --git a/Windows.md b/Windows.md index 72f914bf..93289de7 100644 --- a/Windows.md +++ b/Windows.md @@ -1,19 +1,4 @@ +The Go wiki on GitHub has moved to go.dev (#61940). -> The Go project's official download page is at [https://go.dev/dl](https://go.dev/dl/). -> -> After downloading a binary release suitable for your system, you can install go by following the official installation instructions at [https://go.dev/doc/install](https://go.dev/doc/install#install). +Try or . - -# Go for Microsoft Windows - -The Windows port is stable and officially supported. - - * See the [open Windows issues](https://github.com/golang/go/issues?q=is%3Aopen+is%3Aissue+label%3Aos-windows) on the issue tracker. - -| **Distributions** | **Architectures** | **Initial support version** | **Final support version** | -|:------------------------------------------|:------------------|:----------------------------|:----------| -| Windows 7, Windows Server 2008R2 or above | amd64, 386 | Go 1 _*_ | | -| Windows Vista, Windows Server 2008 | amd64, 386 | Go 1 _*_ | Go 1.10.8 | -| Windows XP, Windows Server 2003 | amd64, 386 | Go 1 _*_ | Go 1.10.8 | - -_*_ Go 1.5 or above is recommended. diff --git a/WindowsBuild.md b/WindowsBuild.md index aed5eb14..120d6743 100644 --- a/WindowsBuild.md +++ b/WindowsBuild.md @@ -1,63 +1,4 @@ -# The Automatic (but unsupported) Way: [winstrap](https://github.com/golang/winstrap) +The Go wiki on GitHub has moved to go.dev (#61940). -The winstrap tool is used by the Go project to turn a fresh Windows VM image into a Windows builder. It installs all necessary dependencies. It's sometimes out of date, though, as it's only updated when we need to update the Windows base image for the [Go continuous build](https://build.golang.org/). - -To use winstrap, download the latest version of winstrap.exe from the [winstrap](https://github.com/golang/winstrap) page and run it. - -It will download some installers to your desktop, which you should run. Just click through; all the defaults are fine. - -Then it will check out Go and place it in c:\Users\\%USER%\goroot and build it. - -That's it. - -Note however that winstrap is not supported. It's considered an internal tool used for occasional setup of new Windows builder images and is not actively maintained until we need it ourselves. - -# The Manual Way - -## Install MinGW/MSYS - -Download and save the latest version of the automated MinGW installer executable (` exe `) file from SourceForge. - -http://sourceforge.net/projects/mingw/files/OldFiles/mingw-get-inst/ - -Open and run the saved automated MinGW installer executable file, which is named ` mingw-get-inst-yyyymmdd.exe `, where ` yyyymmdd ` is the version date stamp. For example, ` mingw-get-inst-20110530.exe `. - -The MinGW Setup Wizard window will open with the title "Setup - MinGW-Get". Except for the following, accept the setup defaults, unless it's necessary to change them. - -For Repository Catalogues, check the Download latest repository catalogues button. - -For Select Components, the MinGW Compiler Suite, the C Compiler box is automatically checked. Scroll down to the bottom of the list and check the MinGW Developer Toolkit box, which includes the MSYS Basic System. - -For Ready to Install, review and verify the installation settings, which should look similar this: -``` - Installing: - mingw-get - pkginfo - C Compiler - MSYS Basic System - MinGW Developer Toolkit - Downloading latest repository catalogues - Destination location: - C:\MinGW -``` -When the installation settings are correct, Install. - -The installation loads the package installation catalogues and downloads and installs the files. The installation may take some time, largely depending on the download speed. - -The MSYS terminal window may be opened by opening and running the ` C:\MinGW\msys\1.0\msys.bat ` batch file. - -## Build - -``` -git clone https://go.googlesource.com/go -cd go\src -all.bat -``` - -## 64-bit Notes - - 1. Ensure you are able to compile a working 32-bit Go first. - 1. Grab the latest zip from http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Automated%20Builds/ and extract it over the MinGW directory, so that for example the .exe files end up in the same location as the 32-bit ones. - 1. Replace ` gcc.exe ` and ` ar.exe ` with their 64-bit counterparts. - 1. Set ` GOARCH=amd64 ` and away you go! +Try or . diff --git a/WindowsCrossCompiling.md b/WindowsCrossCompiling.md index 13929209..eeda169f 100644 --- a/WindowsCrossCompiling.md +++ b/WindowsCrossCompiling.md @@ -1,118 +1,4 @@ -# Building Windows Go programs on Linux +The Go wiki on GitHub has moved to go.dev (#61940). -See [here](https://go.dev/doc/install/source#environment) for available `GOOS` and `GOARCH` values. +Try or . -## Go version >= 1.5 - -Since Go version 1.5 cross-compiling of pure Go executables has become very easy. Try it out with the code below. More can be found at this blog post by [Dave Cheney][1]. - -[1]: http://dave.cheney.net/2015/08/22/cross-compilation-with-go-1-5 - -```go -$ cat hello.go -package main - -import "fmt" - -func main() { - fmt.Printf("Hello\n") -} -$ GOOS=windows GOARCH=386 go build -o hello.exe hello.go -``` - -In cmd.exe instead of PowerShell: - -```go -$ set GOOS=windows -$ set GOARCH=386 -$ go build -o hello.exe hello.go -``` - -You can now run `hello.exe` on a Windows machine near you. - -Note that the command above will silently rebuild most of standard library, and for this reason will be quite slow. To speed-up the process, you can install all the windows-amd64 standard packages on your system with - -``` -GOOS=windows GOARCH=amd64 go install -``` - -Note also that `cgo` is disabled when cross-compiling, so any file that mentions `import "C"` will be silently ignored (See https://github.com/golang/go/issues/24068). In order to use cgo, or any of the build modes `c-archive`, `c-shared`, `shared`, `plugin`, you need to have a C cross-compiler. - - -## Older Go version (<1.5) - -I use linux/386, but, I suspect, this procedure will apply to other host platforms as well. - -Preparation (if needed): -```sh -sudo apt-get install gcc -export go env GOROOT -``` - -First step is to build host version of go: - -```sh -cd $GOROOT/src -sudo -E GOOS=windows GOARCH=386 PATH=$PATH ./make.bash -``` - -Next you need to build the rest of go compilers and linkers. I have small program to do that: - -```sh -$ cat ~/bin/buildcmd -#!/bin/sh -set -e -for arch in 8 6; do - for cmd in a c g l; do - go tool dist install -v cmd/$arch$cmd - done -done -exit 0 -``` - -Last step is to build Windows versions of standard commands and libraries. I have a small script for that too: - -```sh -$ cat ~/bin/buildpkg -#!/bin/sh -if [ -z "$1" ]; then - echo 'GOOS is not specified' 1>&2 - exit 2 -else - export GOOS=$1 - if [ "$GOOS" = "windows" ]; then - export CGO_ENABLED=0 - fi -fi -shift -if [ -n "$1" ]; then - export GOARCH=$1 -fi -cd $GOROOT/src -go tool dist install -v pkg/runtime -go install -v -a std -``` - -I run it like that: - -```sh -$ ~/bin/buildpkg windows 386 -``` - -to build Windows/386 version of Go commands and packages. You can probably see from my script that I exclude building of any cgo related parts — these will not work for me, since I do not have correspondent gcc cross-compiling tools installed. So I just skip those. - -Now we're ready to build our Windows executable: - -```go -$ cat hello.go -package main - -import "fmt" - -func main() { - fmt.Printf("Hello\n") -} -$ GOOS=windows GOARCH=386 go build -o hello.exe hello.go -``` - -We just need to find a Windows computer to run our `hello.exe`. \ No newline at end of file diff --git a/WindowsDLLs.md b/WindowsDLLs.md index e3df9ff5..786830e9 100644 --- a/WindowsDLLs.md +++ b/WindowsDLLs.md @@ -1,130 +1,4 @@ -# Calling a Windows DLL +The Go wiki on GitHub has moved to go.dev (#61940). -Go allows you to call native Windows function in several different ways. +Try or . -1. Dynamically load a DLL, then call a function in it. You can call the function via `SyscallX` (where X is the number of parameters. If the function has fewer parameters than that, for example passing 7 arguments to a function that accepts 9, `Syscall9` will still work, you just need to specify 7 as your second argument to `Syscall9`). - -A sample Go program that calls a Windows DLL function using this method: - -```go -package main - -import ( - "fmt" - "syscall" - "unsafe" -) - -func abort(funcname string, err error) { - panic(fmt.Sprintf("%s failed: %v", funcname, err)) -} - -var ( - kernel32, _ = syscall.LoadLibrary("kernel32.dll") - getModuleHandle, _ = syscall.GetProcAddress(kernel32, "GetModuleHandleW") - - user32, _ = syscall.LoadLibrary("user32.dll") - messageBox, _ = syscall.GetProcAddress(user32, "MessageBoxW") -) - -const ( - MB_OK = 0x00000000 - MB_OKCANCEL = 0x00000001 - MB_ABORTRETRYIGNORE = 0x00000002 - MB_YESNOCANCEL = 0x00000003 - MB_YESNO = 0x00000004 - MB_RETRYCANCEL = 0x00000005 - MB_CANCELTRYCONTINUE = 0x00000006 - MB_ICONHAND = 0x00000010 - MB_ICONQUESTION = 0x00000020 - MB_ICONEXCLAMATION = 0x00000030 - MB_ICONASTERISK = 0x00000040 - MB_USERICON = 0x00000080 - MB_ICONWARNING = MB_ICONEXCLAMATION - MB_ICONERROR = MB_ICONHAND - MB_ICONINFORMATION = MB_ICONASTERISK - MB_ICONSTOP = MB_ICONHAND - - MB_DEFBUTTON1 = 0x00000000 - MB_DEFBUTTON2 = 0x00000100 - MB_DEFBUTTON3 = 0x00000200 - MB_DEFBUTTON4 = 0x00000300 -) - -func MessageBox(caption, text string, style uintptr) (result int) { - var nargs uintptr = 4 - ret, _, callErr := syscall.Syscall9(uintptr(messageBox), - nargs, - 0, - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(text))), - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(caption))), - style, - 0, - 0, - 0, - 0, - 0) - if callErr != 0 { - abort("Call MessageBox", callErr) - } - result = int(ret) - return -} - -func GetModuleHandle() (handle uintptr) { - var nargs uintptr = 0 - if ret, _, callErr := syscall.Syscall(uintptr(getModuleHandle), nargs, 0, 0, 0); callErr != 0 { - abort("Call GetModuleHandle", callErr) - } else { - handle = ret - } - return -} - -func main() { - defer syscall.FreeLibrary(kernel32) - defer syscall.FreeLibrary(user32) - - fmt.Printf("Return: %d\n", MessageBox("Done Title", "This test is Done.", MB_YESNOCANCEL)) -} - -func init() { - fmt.Print("Starting Up\n") -} -``` - - -2. Using syscall.NewProc instead of syscall.GetProcAddress. These are basically some helper methods over the syscall ones, you saw above, and are available in Windows only: http://golang.org/src/pkg/syscall/dll_windows.go - -```go -package main - -import ( - "fmt" - "syscall" - "unsafe" -) - -func main() { - var mod = syscall.NewLazyDLL("user32.dll") - var proc = mod.NewProc("MessageBoxW") - var MB_YESNOCANCEL = 0x00000003 - - ret, _, _ := proc.Call(0, - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr("This test is Done."))), - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr("Done Title"))), - uintptr(MB_YESNOCANCEL)) - fmt.Printf("Return: %d\n", ret) - -} -``` - -3. By "linking" against the library, using the "[[cgo]]" method (this way works in Linux and Windows). Example: - -```go -import ("C") -... -C.MessageBoxW(...) -``` - -See [[cgo]] for further details. \ No newline at end of file diff --git a/X-Repositories.md b/X-Repositories.md index 4be93129..f577c313 100644 --- a/X-Repositories.md +++ b/X-Repositories.md @@ -1,26 +1,4 @@ -The `golang.org/x/...` repositories are part of the Go Project but outside the main Go tree. +The Go wiki on GitHub has moved to go.dev (#61940). -They are developed under looser [compatibility requirements](https://go.dev/doc/go1compat) than the Go core. In general, they will support the previous two releases and tip. +Try or . -These repositories should have no third-party dependencies apart from other golang.org/x/... repositories. The only exceptions are [golang.org/x/tools/gopls](https://pkg.go.dev/golang.org/x/tools/gopls), [golang.org/x/vscode-go](https://go.googlesource.com/vscode-go), and [golang.org/x/pkgsite](https://pkg.go.dev/golang.org/x/pkgsite). If you would like to add a new dependency to an x repository, please [file an issue](https://github.com/golang/go/issues/new) and cc [@rsc](http://github.com/rsc) and [@andybons](https://github.com/andybons). - -Install them with "go get". - - * [[docs](https://pkg.go.dev/golang.org/x/tools)] [[source](https://go.googlesource.com/tools)] ` golang.org/x/tools ` — godoc, vet, cover, and other tools. - * [[docs](https://pkg.go.dev/golang.org/x/mobile)] [[source](https://go.googlesource.com/mobile)] ` golang.org/x/mobile ` — libraries and build tools for Go on Android. - - * [[docs](https://pkg.go.dev/golang.org/x/crypto)] [[source](https://go.googlesource.com/crypto)] ` golang.org/x/crypto ` — additional cryptography packages. - * [[docs](https://pkg.go.dev/golang.org/x/image)] [[source](https://go.googlesource.com/image)] ` golang.org/x/image ` — additional imaging packages. - * [[docs](https://pkg.go.dev/golang.org/x/net)] [[source](https://go.googlesource.com/net)] ` golang.org/x/net ` — additional networking packages. - * [[docs](https://pkg.go.dev/golang.org/x/sys)] [[source](https://go.googlesource.com/sys)] ` golang.org/x/sys ` — for low-level interactions with the operating system. - * [[docs](https://pkg.go.dev/golang.org/x/text)] [[source](https://go.googlesource.com/text)] ` golang.org/x/text ` — packages for working with text. - - * [[docs](https://pkg.go.dev/golang.org/x/blog)] [[source](https://go.googlesource.com/blog)] ` golang.org/x/blog ` — the content and server program for [blog.golang.org](https://go.dev/blog). - - - * [[docs](https://pkg.go.dev/golang.org/x/review)] [[source](https://go.googlesource.com/review)] ` golang.org/x/review ` — tools for code review. - * [[docs](https://pkg.go.dev/golang.org/x/benchmarks)] [[source](https://go.googlesource.com/benchmarks)] ` golang.org/x/benchmarks ` - - * [[docs](https://pkg.go.dev/golang.org/x/exp)] [[source](https://go.googlesource.com/exp)] ` golang.org/x/exp ` — experimental code (handle with care). - -[List of all packages in sub-repositories](https://pkg.go.dev/golang.org/x) diff --git a/_Footer.md b/_Footer.md index 8bb55127..117cb112 100644 --- a/_Footer.md +++ b/_Footer.md @@ -1,3 +1,4 @@ - - - +The Go wiki on GitHub has moved to go.dev (#61940). + +Try or . + diff --git a/cgo.md b/cgo.md index f0290939..d54f0c1d 100644 --- a/cgo.md +++ b/cgo.md @@ -1,382 +1,4 @@ -# Introduction +The Go wiki on GitHub has moved to go.dev (#61940). -First, https://pkg.go.dev/cmd/cgo is the primary cgo documentation. +Try or . -There is also a good introduction article at https://go.dev/blog/cgo - -## The basics - -If a Go source file imports ` "C" `, it is using cgo. The Go file will have access to anything appearing in the comment immediately preceding the line ` import "C" `, and will be linked against all other cgo comments in other Go files, and all C files included in the build process. - -Note that there must be no blank lines in between the cgo comment and the import statement. - -To access a symbol originating from the C side, use the package name ` C `. That is, if you want to call the C function ` printf() ` from Go code, you write ` C.printf() `. Since variable argument methods like printf aren't supported yet (issue [975](https://github.com/golang/go/issues/975)), we will wrap it in the C method "myprint": - -```go -package cgoexample - -/* -#include -#include - -void myprint(char* s) { - printf("%s\n", s); -} -*/ -import "C" - -import "unsafe" - -func Example() { - cs := C.CString("Hello from stdio\n") - C.myprint(cs) - C.free(unsafe.Pointer(cs)) -} -``` - -## Calling Go functions from C - -It is possible to call both top-level Go functions and function variables from C code invoked from Go code using cgo. - -### Global functions - -Go makes its functions available to C code through use of a special ` //export ` comment. -Note: you can't define any C functions in preamble if you're using exports. - -For example, there are two files, foo.c and foo.go: -foo.go contains: - -```go -package gocallback - -import "fmt" - -/* -#include -extern void ACFunction(); -*/ -import "C" - -//export AGoFunction -func AGoFunction() { - fmt.Println("AGoFunction()") -} - -func Example() { - C.ACFunction() -} -``` - -foo.c contains: - -```go -#include "_cgo_export.h" -void ACFunction() { - printf("ACFunction()\n"); - AGoFunction(); -} -``` - -### Function variables - -The following code shows an example of invoking a Go callback from C code. Because of the [pointer passing rules](https://pkg.go.dev/cmd/cgo/#hdr-Passing_pointers) Go code can not pass a function value directly to C. Instead it is necessary to use an indirection. This example uses a registry with a mutex, but there are many other ways to map from a value that can be passed to C to a Go function. - -```go -package gocallback - -import ( - "fmt" - "sync" -) - -/* -extern void go_callback_int(int foo, int p1); - -// normally you will have to define function or variables -// in another separate C file to avoid the multiple definition -// errors, however, using "static inline" is a nice workaround -// for simple functions like this one. -static inline void CallMyFunction(int foo) { - go_callback_int(foo, 5); -} -*/ -import "C" - -//export go_callback_int -func go_callback_int(foo C.int, p1 C.int) { - fn := lookup(int(foo)) - fn(p1) -} - -func MyCallback(x C.int) { - fmt.Println("callback with", x) -} - -func Example() { - i := register(MyCallback) - C.CallMyFunction(C.int(i)) - unregister(i) -} - -var mu sync.Mutex -var index int -var fns = make(map[int]func(C.int)) - -func register(fn func(C.int)) int { - mu.Lock() - defer mu.Unlock() - index++ - for fns[index] != nil { - index++ - } - fns[index] = fn - return index -} - -func lookup(i int) func(C.int) { - mu.Lock() - defer mu.Unlock() - return fns[i] -} - -func unregister(i int) { - mu.Lock() - defer mu.Unlock() - delete(fns, i) -} -``` - -As of Go 1.17, the `runtime/cgo` package provides [runtime/cgo.Handle](https://pkg.go.dev/runtime/cgo@go1.17#Handle) mechanism and simplifies the above examples to: - -```go -package main - -import ( - "fmt" - "runtime/cgo" -) - -/* -#include - -extern void go_callback_int(uintptr_t h, int p1); -static inline void CallMyFunction(uintptr_t h) { - go_callback_int(h, 5); -} -*/ -import "C" - -//export go_callback_int -func go_callback_int(h C.uintptr_t, p1 C.int) { - fn := cgo.Handle(h).Value().(func(C.int)) - fn(p1) -} - -func MyCallback(x C.int) { - fmt.Println("callback with", x) -} - -func main() { - h := cgo.NewHandle(MyCallback) - C.CallMyFunction(C.uintptr_t(h)) - h.Delete() -} -``` - -### Function pointer callbacks - -C code can call exported Go functions with their explicit name. But if a C-program wants a function pointer, a gateway function has to be written. This is because we can't take the address of a Go function and give that to C-code since the cgo tool will generate a stub in C that should be called. The following example shows how to integrate with C code wanting a function pointer of a give type. - -Place these source files under _$GOPATH/src/ccallbacks/_. Compile and run with: - -```console -$ gcc -c clibrary.c -$ ar cru libclibrary.a clibrary.o -$ go build -$ ./ccallbacks -Go.main(): calling C function with callback to us -C.some_c_func(): calling callback with arg = 2 -C.callOnMeGo_cgo(): called with arg = 2 -Go.callOnMeGo(): called with arg = 2 -C.some_c_func(): callback responded with 3 -``` - -**goprog.go** - -```go -package main - -/* -#cgo CFLAGS: -I . -#cgo LDFLAGS: -L . -lclibrary - -#include "clibrary.h" - -int callOnMeGo_cgo(int in); // Forward declaration. -*/ -import "C" - -import ( - "fmt" - "unsafe" -) - -//export callOnMeGo -func callOnMeGo(in int) int { - fmt.Printf("Go.callOnMeGo(): called with arg = %d\n", in) - return in + 1 -} - -func main() { - fmt.Printf("Go.main(): calling C function with callback to us\n") - C.some_c_func((C.callback_fcn)(unsafe.Pointer(C.callOnMeGo_cgo))) -} -``` - -**cfuncs.go** - -```go -package main - -/* - -#include - -// The gateway function -int callOnMeGo_cgo(int in) -{ - printf("C.callOnMeGo_cgo(): called with arg = %d\n", in); - int callOnMeGo(int); - return callOnMeGo(in); -} -*/ -import "C" -``` - -**clibrary.h** - -```c -#ifndef CLIBRARY_H -#define CLIBRARY_H -typedef int (*callback_fcn)(int); -void some_c_func(callback_fcn); -#endif -``` - -**clibrary.c** - -```c -#include - -#include "clibrary.h" - -void some_c_func(callback_fcn callback) -{ - int arg = 2; - printf("C.some_c_func(): calling callback with arg = %d\n", arg); - int response = callback(2); - printf("C.some_c_func(): callback responded with %d\n", response); -} -``` - -## Go strings and C strings - -Go strings and C strings are different. Go strings are the combination of a length and a pointer to the first character in the string. C strings are just the pointer to the first character, and are terminated by the first instance of the null character, ` '\0' `. - -Go provides means to go from one to another in the form of the following three functions: - * ` func C.CString(goString string) *C.char ` - * ` func C.GoString(cString *C.char) string ` - * ` func C.GoStringN(cString *C.char, length C.int) string ` - -One important thing to remember is that ` C.CString() ` will allocate a new string of the appropriate length, and return it. That means the C string is not going to be garbage collected and it is up to **you** to free it. A standard way to do this follows. - -```go -// #include -import "C" -import "unsafe" -... - var cmsg *C.char = C.CString("hi") - defer C.free(unsafe.Pointer(cmsg)) - // do something with the C string -``` - -Of course, you aren't required to use ` defer ` to call ` C.free() `. You can free the C string whenever you like, but it is your responsibility to make sure it happens. - -## Turning C arrays into Go slices - -C arrays are typically either null-terminated or have a length kept elsewhere. - -Go provides the following function to make a new Go byte slice from a C array: - * ` func C.GoBytes(cArray unsafe.Pointer, length C.int) []byte ` - -To create a Go slice backed by a C array (without copying the original data), one needs to acquire this length at runtime and use a type conversion to a pointer to a very big array and then slice it to the length that you want (also remember to set the cap if you're using Go 1.2 or later), for example (see https://go.dev/play/p/XuC0xqtAIC for a runnable example): - -```go -import "C" -import "unsafe" -... - var theCArray *C.YourType = C.getTheArray() - length := C.getTheArrayLength() - slice := (*[1 << 28]C.YourType)(unsafe.Pointer(theCArray))[:length:length] -``` - -With Go 1.17 or later, programs can use `unsafe.Slice` instead, which similarly results in a Go slice backed by a C array: - -```go -import "C" -import "unsafe" -... - var theCArray *C.YourType = C.getTheArray() - length := C.getTheArrayLength() - slice := unsafe.Slice(theCArray, length) // Go 1.17 -``` - -It is important to keep in mind that the Go garbage collector will not interact with the underlying C array, and that if it is freed from the C side of things, the behavior of any Go code using the slice is nondeterministic. - -## Common Pitfalls -### Struct Alignment Issues -As Go doesn't support packed struct (e.g., structs where maximum alignment is 1 byte), you can't -use packed C struct in Go. Even if your program passes compilation, it won't do what you want. -To use it, you have to read/write the struct as byte array/slice. - -Another problem is that some types has lower alignment requirement than their counterpart in Go, -and if that type happens to be aligned in C but not in Go rules, that struct simply can't be represented -in Go. An example is this ([issue 7560](https://github.com/golang/go/issues/7560)): - -```go -struct T { - uint32_t pad; - complex float x; -}; -``` -Go's complex64 has an alignment of 8-byte, where as C has only 4-byte (because C treats the -complex float internally as a ` struct { float real; float imag; } `, not a basic type), this T struct simply -doesn't have a Go representation. For this case, if you control the layout of the struct, move the -complex float so that it is also aligned to 8-byte is better, and if you're not willing to move it, -use this form will force it to align to 8-byte (and waste 4-byte): - -```go -struct T { - uint32_t pad; - __attribute__((align(8))) complex float x; -}; -``` - -However, if you don't control the struct layout, you will have to define accessor C functions for -that struct because cgo won't be able to translate that struct into equivalent Go struct. - -### ` //export ` and definition in preamble -If a Go source file uses any ` //export ` directives, then the C code in the comment may only include declarations (` extern int f(); `), not definitions (` int f() { return 1; } ` or ` int n; `). -Note: you can use ` static inline ` trick to work around this restriction for tiny functions defined -in the preamble (see above for a complete example). - -### Windows - -In order to use cgo on Windows, you'll also need to first install a gcc compiler (for instance, mingw-w64) and have gcc.exe (etc.) in your PATH environment variable before compiling with cgo will work. - -### environmental variables -Go os.Getenv() doesn't see variables set by C.setenv() - - -### tests -_test.go files can't use cgo. diff --git a/golang-tools.md b/golang-tools.md index 7d300455..73d7b9a0 100644 --- a/golang-tools.md +++ b/golang-tools.md @@ -1,104 +1,4 @@ -# Mission statement +The Go wiki on GitHub has moved to go.dev (#61940). -The golang-tools community is a group of people whose main focus and interest is the development of tools for the Go language. It is open to everyone. Tooling topics include (but are not limited to) code analysis, compilers, editor and IDE plugins, language servers, and standard libraries. +Try or . -The golang-tools working group is useful for: - -* getting feedback on ideas -* experimenting with a group of "trusted testers" -* external proof-reading of proposals, blog posts etc - -A key goal of the golang-tools group is that all forums of communication, but especially the regular calls, are friendly and welcoming. We want to create an environment in which everyone feels both supported and able to share their opinions and experience, frankly, freely, and openly. The wider [Go Code of Conduct](https://go.dev/conduct), which we observe just like all other Go forums, summarises this well. - -# Community spaces - -Discussion within the community takes place in three main spaces. There are also dedicated golang-tools sessions held at GopherCon each year. - -## Slack - -Most day-to-day discussion take place in the `#tools` channel on the [Gophers Slack](https://gophers.slack.com/) ([sign-up here](https://invite.slack.golangbridge.org/)). - -## Mailing list - -The [golang-tools](https://groups.google.com/forum/#!forum/golang-tools) mailing list contains community updates as well as other forms of announcements. - -## Calls - -The community operates a monthly “catch-up” call covering updates about large-impact changes, new tool initiatives, ongoing community projects and much more. The agenda is community-driven and anyone can suggest items that they would like to cover. - -Like the other discussion spaces these calls are open to anyone and people new to the community are encouraged to join in and share in the conversation. The details (date, link, phone number, …) for each call are shared via the mailing list as well as the Slack channel. - -### Shared Calendar - -As of October 2020, all calls/events will be added to the [shared calendar](https://calendar.google.com/calendar/u/0?cid=Y19vNjYyZXR1YTZlNTdsNW9kdDI0M2w5ZmxiOEBncm91cC5jYWxlbmRhci5nb29nbGUuY29t). - -### Upcoming calls - -Note that calls always happen on the same [Google Meet link](https://meet.google.com/xuq-tcoc-dkp). Anyone can join the calls - no Google account is required. - -* 2023-01-29 - [Agenda](https://docs.google.com/document/d/1LKY-JRrPKkxoonvq7c3rr_DExzl_8X2Iq1TR8V0C3lg/edit?usp=sharing) - -### Call archive - -* 2023-11-29 - [Meeting notes](https://docs.google.com/document/d/1lzGFo6QxZaDohSW9DOC2rILAuFCNX2vWs8oon6etmWY/edit) - [video](https://www.youtube.com/watch?v=6uzF0q49kCg) -* 2023-09-13 - [Meeting notes](https://docs.google.com/document/d/1CvFXUGjSnSPde5lKdERJZY4t4ifwLyhtaok6TZJ-RR0/edit) - [video](https://www.youtube.com/watch?v=JMiXnAkYZno) -* 2023-07-12 - [Meeting notes](https://docs.google.com/document/d/1NZ9BrdDm36_wsIyKinBnNEKYfldsfzLjEzjtGaqD284/edit) - [video](https://www.youtube.com/watch?v=QXdCfsPH504) -* 2023-04-19 - [Meeting notes](https://docs.google.com/document/d/1bUHgwr7TlNWr-_7Z8yWNHlmfchJn2O6xZy6xN-2vNKA/edit) - [video](https://www.youtube.com/watch?v=1DGnsXIo03Y) -* 2023-02-22 - [Meeting notes](https://docs.google.com/document/d/1Tly7F5k_Hr-_BMOgjWZYJu5oObc-CLblOyTSVtp85Y4/edit) - [video](https://www.youtube.com/watch?v=2wGFFyVLdy8) -* 2023-01-11 - [Meeting notes](https://docs.google.com/document/d/1AzX7Gj2p-VlesbCEF3PbQhAYV3jpM-QWqWQIWHBAJtw/edit) - [video](https://www.youtube.com/watch?v=lwh3_1_T_AU) -* 2022-11-16 - [Meeting notes](https://docs.google.com/document/d/1XQItB9RIPWLWOwXH1u7TsdXvkzKqOtANIBQwBz36MxQ/edit) - [video](https://www.youtube.com/watch?v=brIgemnAPJI) -* 2022-09-21 - [Meeting notes](https://docs.google.com/document/d/1VrbwBXd5lMny-bacytlFSMm2Uf6CWGonAXqmnS9Q9Vs/edit) - [video](https://www.youtube.com/watch?v=HE9LGb_1haQ) -* 2022-08-03 - [Meeting notes](https://docs.google.com/document/d/1AQtZQaGwxTpQdyEY4q2dyo1HyP8P3JQgpXZF0LcsiD0/edit) - [video](https://youtu.be/R6l21BlQoWM) -* 2022-06-22 - [Meeting notes](https://docs.google.com/document/d/17XSlU8kIIqbyjGbIqXx-G_ByhlrNjxIxVbu6kLK5QMY/edit) - [video](https://www.youtube.com/watch?v=nnjydSz1gM4) -* 2022-05-18 - [Meeting notes](https://docs.google.com/document/d/13pLMmPRcqyAsGgzCjbb145N9KF2AiBW7u6I5jornQaA/edit) - [video](https://youtu.be/PiUC0qN4n90) -* 2022-04-13 - [Meeting notes](https://docs.google.com/document/d/1HaBRsUK9z2UygQPsO7Q5gVV0vM7fL085ScpEHpSUrnc/edit) - [video](https://www.youtube.com/watch?v=5f5c7oOWxEQ) -* 2022-02-16 - [Meeting notes](https://docs.google.com/document/d/1XWEAauEY_TOe-gd04IHA2bRgLGd8SMsOfvW3ak8oDTY/edit) - [video](https://www.youtube.com/watch?v=7S_tGsE7pA4) -* 2022-01-12 - [Meeting notes](https://docs.google.com/document/d/1SNCAJesMR8KJjyM-AlVTZStrRfTNTUOiYX-FvyL-8nQ/edit) - [video](https://youtu.be/oXm-JFzbSYY) -* 2021-10-06 - [Meeting notes](https://docs.google.com/document/d/15CTfyASn5wBgpAAGhOpgaGg7LaUVd7WYVSZHuybTTVk/edit) - [video](https://youtu.be/VaKo_8oTRK4) -* 2021-09-15 special edition: supporting type parameters [Agenda](https://docs.google.com/document/d/1Wk2Jp9yV8h3ApKsepBrsE37s8f4sDb0eVjfGOaIPsHM) -* 2021-08-18 - [Meeting notes](https://docs.google.com/document/d/1fFwOXTOmPvR2E240z5WC1_VVs7h5vhcH4M81qT-2fW0/edit#) - [video](https://youtu.be/yd7eC7myvfA) -* 2021-06-16 - [Meeting notes](https://docs.google.com/document/d/1P6gv4lHoHz27-PzI2dpmYzdPej2yWHEN2J3L2Czvy2E/edit#) - [video](https://youtu.be/KqFpAS6yfVU) -* 2021-05-12 - [Meeting notes](https://docs.google.com/document/d/1GFbAAkRfGV_U9b2afFyLjdVgkIu0XrOjWeWig7rfUkk/edit#) - [video](https://youtu.be/rH62CnkYlEs) -* 2021-04-14 - [Meeting notes](https://docs.google.com/document/d/1w4E4a6QptBn2R3ispbYdhcNmir0JfD_z9r7W1q00Xxk/edit#) - [video](https://youtu.be/jyFz4jM25u8) -* 2021-03-10 - [Meeting notes](https://docs.google.com/document/d/1C-XxosukrdAr1KZH6YTJR_xvKcDS9bh-AyxTxnWq0lk/edit#) - [video](https://youtu.be/IphhYpCJJXw) -* 2021-02-10 - [Meeting notes](https://docs.google.com/document/d/1tMg4QUtK-bB9j0mlP_bV94yLttmdyCawsDzSSp0M4A0/edit#) - [video](https://youtu.be/E078rWljk7g) -* 2021-01-13 - [Meeting notes](https://docs.google.com/document/d/1PF07-EfaYi86Fl9pzpEVfuC9G6M52y5fxmttxjExFNk/edit#) - [video](https://youtu.be/qz8hBQhYtQs) -* 2020-11-18 - [Meeting notes](https://docs.google.com/document/d/1iH4fPsQv36J1XBNVZ6oU1OuVI1R9CMKCLpKqk14jpp0/edit#) - [video](https://youtu.be/Nh05OITe2dY) -* 2020-10-21 - [Meeting notes](https://docs.google.com/document/d/1P4X9OKlHq0UlcAEyGCkVYyCML4grObpiD2zDEK5f5nQ/edit#) - [video](https://youtu.be/fFl5Ddt3fxc) -* 2020-09-16 - [Meeting notes](https://docs.google.com/document/d/1GJ5K2fYVXPG6pOzUh6xMFv1Nq5VTaBylDP1Z0y-SHHw/edit#) - [video](https://youtu.be/MlVbgQnq9vE) -* 2020-08-19 - [Meeting notes](https://docs.google.com/document/d/17dQqU9V-86j-8H-063ehVt5nsRnQjfXfvDMG_FzkOY0/edit#) - [video](https://youtu.be/dKLunKg-rvw) -* 2020-07-22 - [Meeting notes](https://docs.google.com/document/d/13hupZM403jvJ9zeld2UU0n05NNdxFCuaLkysYNDj7vg/edit#) - [video](https://youtu.be/m3b2zl1WJ-s) -* 2020-06-24 - [Meeting notes](https://docs.google.com/document/d/1Seg5Rda1wekSM5CIiNjX9m0I3FSjlEd98RH0xAqCyEs/edit#) - [video](https://youtu.be/i6yIBHbGbtg) -* 2020-05-13 - [Meeting notes](https://docs.google.com/document/d/11NVS-dsJ-IvIM4hAzxlGvyh_8DxdntnQpYugda1zv1I/edit#) - [video](https://youtu.be/PkZenOPIRfw) -* 2020-04-08 - [Meeting notes](https://docs.google.com/document/d/1DkRPo0tCG3iIy0Y1_vfbwEou3drXDYcH_HpxlAqRrOc/edit#) - [video](https://youtu.be/av1wUxqtifU) -* 2020-03-11 - [Meeting notes](https://docs.google.com/document/d/1gURv4JVuhSi_Rl68Wn7F4J9ZfHyjtt2YM1QVkotDB68/edit#) - [video](https://youtu.be/Q-nv_eU14cE) -* 2020-01-28 - [Meeting notes](https://docs.google.com/document/d/1Fj8TQSmEC6iWNrF_31-qEueWFY1KKs2AuQRc_4rWM4A/edit#) - [video](https://www.youtube.com/watch?v=rvuM4lfHcfA) -* 2019-12-03 - [Meeting notes](https://docs.google.com/document/d/1ABilBtF7F1tFaGxX3fKZH2zrqADhpoMMcGHFoqJyEtE/edit#) - [video](https://www.youtube.com/watch?v=DeHYSvSKenA&feature=youtu.be) -* 2019-10-29 - [Meeting notes](https://docs.google.com/document/d/1F3T58Nj_Ft3bu15Wd4hAZAW6kLl_M1EH5XP43l_3CpY/edit#) - [video](https://www.youtube.com/watch?v=hFJMi9KS0dY&feature=youtu.be) -* 2019-09-24 - [Meeting notes](https://docs.google.com/document/d/1FpM5xjNdLnVMYxdPxLRHt6-yYBJ7zURWNbUB8QtFSlw/edit#) - [video](https://www.youtube.com/watch?v=E5w02B62oqc&feature=youtu.be) -* 2019-08-27 - [Meeting notes](https://docs.google.com/document/d/1NiIbz1h4-UaavdL-SC2hTp54Y87p-1joaLa-r5HgKaE/edit#) - [video](https://www.youtube.com/watch?v=OTKPu0kZ6sQ&feature=youtu.be) -* 2019-07-26 - [Meeting notes - second session at GopherCon San Diego](https://docs.google.com/document/d/1ZI_WqpLCB8DO6teJ3aBuXTeYD2iZZZlkDptmcY6Ja60/edit#) -* 2019-07-25 - [Meeting notes - first session at GopherCon San Diego](https://docs.google.com/document/d/1-RVyttQ0ncjCpR_sRwizf-Ubedkr0Emwmk2LhnsUOmE/edit) -* 2019-05-28 - [Meeting notes](https://docs.google.com/document/d/15gibnpGJyY-cJeRFIDf_mHzlbSnbZWGHvr5PJqQKUUY/edit?usp=sharing) - [video](https://www.youtube.com/watch?v=qmDsGU0-s7Y&feature=youtu.be) -* 2019-04-30 - [Meeting notes](https://docs.google.com/document/d/179fHEOR2gfJJnu3EouZ11wu01UDun7E0NNfuJywCVFQ/edit?usp=sharing) - [video](https://www.youtube.com/watch?v=xG-dNIK82rc) -* 2019-03-26 - [Meeting notes](https://docs.google.com/document/d/1FWuluOoaQO4kSzPqLuwJC-P3edPme2nEbeo1eNAw-XY/edit?usp=sharing) - [video](https://www.youtube.com/watch?v=fJsi85TunPs) -* 2019-02-26 - [Meeting notes](https://docs.google.com/document/d/1e5JvIKrBS8WKGbMSjDK7H9pMfWQAZ7V-QvQodRhqBl0/edit?usp=sharing) - [video](https://www.youtube.com/watch?v=eRB24Xe64D8&feature=youtu.be) -* 2019-01-29 - [Meeting notes](https://docs.google.com/document/d/1pBKM4GqeBRfas7-RCHPuP-eVz4AfjKInAkKnPS-UkTA/edit?usp=sharing) - [video](https://www.youtube.com/watch?v=mKAj_6ZbvfM) -* 2018-12-11 - [Meeting notes](https://docs.google.com/document/d/1HbjhgorPAUHb6035Uk3vA-EUOyn4TYMND_HT-zc7ecw/edit) - [video](https://www.youtube.com/watch?v=5isg5Xv3Yr0&feature=youtu.be) -* 2018-11-27 - [Meeting notes](https://docs.google.com/document/d/1zP2nKVHolqBoTVOsyKWo5b0o7vimJvhqQ9Ucp8rnrKA/edit) - [video](https://www.youtube.com/watch?v=7Rir0AgfiWg&feature=youtu.be) -* 2018-11-06 - [Meeting Notes](https://docs.google.com/document/d/1rXFrs046jTkVs0fTnQ-ItakV2zKCSxqwV4bfJ6DJWB4/edit) -* 2018-10-23 - [Meeting Notes](https://docs.google.com/document/d/1-bsbA0pDwbnEgPSjQsOo3gnvhToHB38jmgMHqiaO2vA/edit) - [video](https://www.youtube.com/watch?v=sqvMq8e0yco&feature=youtu.be) -* 2018-10-09 - [Meeting notes](https://docs.google.com/document/d/1oEknhf60Cdg9p_i17ESIm3zjTuVK7Adr-lTw78D0Qrc/edit#heading=h.gb40p8nfpls3) - [video](https://www.youtube.com/watch?v=MGwexofwe_U&feature=youtu.be) -* 2018-09-18 - [Meeting notes](https://docs.google.com/document/d/1G7bEKWeFRjd9rPCkBJooC76CCb0Jiem5F_Q48C1zecQ/edit) - [video](https://www.youtube.com/watch?v=xrEtakZ7oWc&feature=youtu.be) -* 2018-08-28 - [Notes from GopherCon "kick off" session](https://docs.google.com/document/d/1lB49VLzDrRd3wbXP1uLf-bHQyJRmH_Dc36JeEBlK-1Q/edit) - -### Organizing a call - -We try to share the load of organizing and running the calls between Gophers inside and outside of Google (generally alternating between Googlers and non-Googlers). Here are the steps required as organizer: - -1. Using a non-google.com account, ask Paul Jolly for editing access to the [shared drive](https://drive.google.com/corp/drive/folders/1V8Eh2cyaSgVMbtD2Cwzdl0du_lU7_eXn), and put a copy of the previous call's agenda in it. The copy will only be visible by anyone with the link, so change that to allow edits (this last step is not possible with docs owned by @google.com accounts). -2. Rename and clear out the agenda for the next call. -3. Update this wiki, archiving the previous call and linking the new upcoming call. -4. Update the [shared calendar](https://calendar.google.com/calendar/u/0?cid=Y19vNjYyZXR1YTZlNTdsNW9kdDI0M2w5ZmxiOEBncm91cC5jYWxlbmRhci5nb29nbGUuY29t) with the new event. By convention calls run from 16:30-17:30 London. -5. Send reminders 1-2 weeks before the call date to the [mailing list](https://groups.google.com/forum/#!forum/golang-tools) and #tools slack channel. -6. On the day of the call, remember to ask a Googler to start recording, and then run through the agenda. diff --git a/gopherbot.md b/gopherbot.md index 480508b7..4f1fea23 100644 --- a/gopherbot.md +++ b/gopherbot.md @@ -1,41 +1,4 @@ -This page outlines all interactive gopherbot functionality. Most of the tasks gopherbot performs do not require human intervention, however it is starting to learn new tricks. +The Go wiki on GitHub has moved to go.dev (#61940). -## Adding/Removing Labels +Try or . -You may add or remove labels by telling gopherbot what you'd like to do. - -`@gopherbot, please add labels NeedsFix,help wanted and remove label needsinvestigation` - -The comma after @gopherbot and the `please`, `and`, `add`, and `label[s]` keywords are optional. Adding a label is the default, so you can have the command be much more terse if you wish. - -`@gopherbot needsfix, help wanted remove needsinvestigation` - -The above command will achieve the same results as the first command. - -If you don't wish to remove anything, you can omit the `remove` keyword. - -`@gopherbot needsfix, help wanted` - -The above command will add the `NeedsFix` and `help wanted` labels. Notice how labels must be separated by a comma (or semicolon). This is to account for those with spaces in them like `help wanted`. You cannot quote the labels. - -`@gopherbot needsfix "help wanted"` **← Does not work** - -Casing also doesn't matter. `needsfix` is equivalent to `NeedsFix`. gopherbot will figure out the right label for you. - -There are some labels that are not allowed to be added or removed. Those can be seen in the `labelChangeDisallowed` function in the [source](https://github.com/golang/build/blob/master/cmd/gopherbot/gopherbot.go). - -For more in-depth examples, take a look at the [tests](https://github.com/golang/build/blob/master/cmd/gopherbot/gopherbot_test.go). - -As always, patches are welcome! - -## Backporting issues - -gopherbot is capable of opening backport issues according to [MinorReleases](https://go.dev/wiki/MinorReleases) in response to comments like the following on the main issue. - -> @gopherbot please consider this for backport to 1.10, it's a regression. - -> @gopherbot please open the backport tracking issues. This is a severe compiler bug. - -The keywords are `@gopherbot`, `backport`, `please` and optionally the release. They can be anywhere in the comment. If no release is mentioned issues are opened for the two past releases. The entire message is quoted in the new issue, so please include a rationale. - -(Note that currently only the first backport command on an issue is executed. https://go.dev/issues/25574) \ No newline at end of file diff --git a/gopls-integrator-FAQ.md b/gopls-integrator-FAQ.md index 9e9f5446..9c0f0dac 100644 --- a/gopls-integrator-FAQ.md +++ b/gopls-integrator-FAQ.md @@ -1,5 +1,4 @@ ---- -> This page has been subsumed into the [committed markdown](https://github.com/golang/tools/blob/master/gopls/doc/integrating.md) of x/tools repository -> -> Please do not edit this page! ---- +The Go wiki on GitHub has moved to go.dev (#61940). + +Try or . + diff --git a/gopls.md b/gopls.md index 81081d08..7aa742ae 100644 --- a/gopls.md +++ b/gopls.md @@ -1,6 +1,4 @@ ----- +The Go wiki on GitHub has moved to go.dev (#61940). + +Try or . -> This page was [moved to the x/tools repository](https://github.com/golang/tools/blob/master/gopls/README.md). -> -> Please do not edit this page! ----- diff --git a/heapdump13.md b/heapdump13.md index 9ef59ad0..d426fd4a 100644 --- a/heapdump13.md +++ b/heapdump13.md @@ -1,183 +1,4 @@ -Heap dump format for other versions: +The Go wiki on GitHub has moved to go.dev (#61940). - * Go 1.4: [[heapdump14]] - * Go 1.5 and later: [[heapdump15-through-heapdump17]] +Try or . -# Introduction - -Go 1.3 added a runtime/debug.WriteHeapDump function that writes all objects in the heap plus additional info (roots, goroutines, finalizers, etc.) to a file. The format of this file is specified here. - - -# Details - -The file starts with the bytes of the string "go1.3 heap dump\n". - -The rest of the file is a sequence of records. Records can be of several different kinds. Records will contain the following primitives: - * uvarint - a 64-bit unsigned integer encoded as in encoding/binary.{Put,Read}Uvarint - * string - a uvarint-encoded length followed by that many bytes of data - * bool - a uvarint-encoded 0 for false or 1 for true - * fieldlist - a description of the pointer-bearing portions of a memory region. It consists of repeated pairs of uvarints encoding a field kind and a field offset, followed by and end-of-list marker. The possible kinds are 1=Ptr, 2=String, 3=Slice, 4=Iface, and 5=Eface. 0=Eol is the end of list marker. The end of list marker does not have a corresponding offset. - -Each record starts with a uvarint-encoded integer describing the type of the record: - * 0 = EOF - * 1 = object - * 2 = otherroot - * 3 = type - * 4 = goroutine - * 5 = stack frame - * 6 = dump params - * 7 = registered finalizer - * 8 = itab - * 9 = OS thread - * 10 = mem stats - * 11 = queued finalizer - * 12 = data segment - * 13 = bss segment - * 14 = defer record - * 15 = panic record - * 16 = alloc/free profile record - * 17 = alloc stack trace sample - -The remaining fields of each record are type-dependent and are described below. - -# EOF - -An EOF record has no fields and must appear last. - -# object - * uvarint: address of object - * uvarint: address of type descriptor (or 0 if unknown) - * uvarint: kind of object (0=regular 1=array 2=channel 127=conservatively scanned) - * string: contents of object - -For array or channel kinds, the type must be nonzero. - -The size of the contents string is the size of the containing sizeclass, not the size of the type itself. As such, contents size may be somewhat bigger than the type size. It may be a lot bigger for array and channel types. For instance, an array with n elements will have a content size bigger than or equal to n times the type size. - -# otherroot - * string: textual description of where this root came from - * uvarint: root pointer - -# type - * uvarint: address of type descriptor - * uvarint: size of an object of this type - * string: name of type - * bool: whether the data field of an interface containing a value of this type is a pointer - * fieldlist: a list of the kinds and locations of pointer-containing fields in objects of this type - -# goroutine (G) - - * uvarint: address of descriptor - * uvarint: pointer to the top of stack (the currently running frame, a.k.a. depth 0) - * uvarint: go routine ID - * uvarint: the location of the go statement that created this goroutine - * uvarint: status - * bool: is a Go routine started by the system - * bool: is a background Go routine - * uvarint: approximate time the go routine last started waiting (nanoseconds since the Epoch) - * string: textual reason why it is waiting - * uvarint: context pointer of currently running frame - * uvarint: address of os thread descriptor (M) - * uvarint: top defer record - * uvarint: top panic record - -Possible statuses: - * 0 = idle - * 1 = runnable - * 3 = syscall - * 4 = waiting - -The wait fields must be present in all cases, but they only mean something if the status is "waiting". - -# stack frame - * uvarint: stack pointer (lowest address in frame) - * uvarint: depth in stack (0 = top of stack) - * uvarint: stack pointer of child frame (or 0 if none) - * string: contents of stack frame - * uvarint: entry pc for function - * uvarint: current pc for function - * uvarint: continuation pc for function (where function may resume, if anywhere) - * string: function name - * fieldlist: list of kind and offset of pointer-containing fields in this frame - -# dump params - - * bool: big endian - * uvarint: pointer size in bytes - * uvarint: channel header size in bytes - * uvarint: starting address of heap - * uvarint: ending address of heap - * uvarint: thechar = architecture specifier - * string: GOEXPERIMENT environment variable value - * uvarint: runtime.ncpu - -# finalizer - * uvarint: address of object that has a finalizer - * uvarint: pointer to FuncVal describing the finalizer - * uvarint: PC of finalizer entry point - * uvarint: type of finalizer argument - * uvarint: type of object - -This finalizer has been registered with the runtime system, but the object to which it refers was either reachable as of the most recent GC or allocated since the most recent GC. - -# itab - * uvarint: Itab address - * bool: whether the data field of an Iface with this itab is a pointer - -# osthread (M) - * uvarint: address of this os thread descriptor - * uvarint: Go internal id of thread - * uvarint: os's id for thread - -# memstats - -Dumps the first 26 fields of [MemStats](https://pkg.go.dev/runtime/#MemStats). All fields are dumped with a uvarint except the 25th which is dumped with 256 uvarints. - -# queuedfinalizer - * uvarint: address of object that has a finalizer - * uvarint: pointer to FuncVal describing the finalizer - * uvarint: PC of finalizer entry point - * uvarint: type of finalizer argument - * uvarint: type of object - -This finalizer is ready to run - the object to which it refers is unreachable. The runtime system just hasn't gotten around to running it yet. - -# data - * uvarint: address of the start of the data segment - * string: contents of the data segment - * fieldlist: kind and offset of pointer-containing fields in the data segment. - -# bss - -Same format as data, but for the bss segment. - -# defer - * uvarint: defer record address - * uvarint: containing goroutine - * uvarint: argp - * uvarint: pc - * uvarint: FuncVal of defer - * uvarint: PC of defer entry point - * uvarint: link to next defer record - -# panic - * uvarint: panic record address - * uvarint: containing goroutine - * uvarint: type ptr of panic arg eface - * uvarint: data field of panic arg eface - * uvarint: ptr to defer record that's currently running - * uvarint: link to next panic record - -# alloc/free profile record - * uvarint: record identifier - * uvarint: size of allocated object - * uvarint: number of stack frames. For each frame: - * - string: function name - * - string: file name - * - uvarint: line number - * uvarint: number of allocations - * uvarint: number of frees - -# alloc sample record - * uvarint: address of object - * uvarint: alloc/free profile record identifier \ No newline at end of file diff --git a/heapdump14.md b/heapdump14.md index 5b1504a5..7b3de6f4 100644 --- a/heapdump14.md +++ b/heapdump14.md @@ -1,178 +1,4 @@ -Heap dump format for other versions: +The Go wiki on GitHub has moved to go.dev (#61940). - * Go 1.3: [[heapdump13]] - * Go 1.5 and later: [[heapdump15-through-heapdump17]] +Try or . -# Introduction - -Go 1.4 has a runtime/debug.WriteHeapDump function that writes all objects in the heap plus additional info (roots, goroutines, finalizers, etc.) to a file. The format of this file is specified here. - - -# Details - -The file starts with the bytes of the string "go1.4 heap dump\n". - -The rest of the file is a sequence of records. Records can be of several different kinds. Records will contain the following primitives: - * uvarint - a 64-bit unsigned integer encoded as in encoding/binary.{Put,Read}Uvarint - * string - a uvarint-encoded length followed by that many bytes of data - * bool - a uvarint-encoded 0 for false or 1 for true - * fieldlist - a description of the pointer-bearing portions of a memory region. It consists of repeated pairs of uvarints encoding a field kind and a field offset, followed by and end-of-list marker. The possible kinds are 1=Ptr, 2=Iface, and 3=Eface. 0=Eol is the end of list marker. The end of list marker does not have a corresponding offset. - -Each record starts with a uvarint-encoded integer describing the type of the record: - * 0 = EOF - * 1 = object - * 2 = otherroot - * 3 = type - * 4 = goroutine - * 5 = stack frame - * 6 = dump params - * 7 = registered finalizer - * 8 = itab - * 9 = OS thread - * 10 = mem stats - * 11 = queued finalizer - * 12 = data segment - * 13 = bss segment - * 14 = defer record - * 15 = panic record - * 16 = alloc/free profile record - * 17 = alloc stack trace sample - -The remaining fields of each record are type-dependent and are described below. - -# EOF - -An EOF record has no fields and must appear last. - -# object - * uvarint: address of object - * string: contents of object - * fieldlist: describes pointer-containing fields of the object - -The size of the contents string is the size of the containing sizeclass, not the size of the object itself. As such, contents size may be somewhat bigger than the contained object's type. - -# otherroot - * string: textual description of where this root came from - * uvarint: root pointer - -# type - * uvarint: address of type descriptor - * uvarint: size of an object of this type - * string: name of type - * bool: whether the data field of an interface containing a value of this type is a pointer - -# goroutine (G) - - * uvarint: address of descriptor - * uvarint: pointer to the top of stack (the currently running frame, a.k.a. depth 0) - * uvarint: go routine ID - * uvarint: the location of the go statement that created this goroutine - * uvarint: status - * bool: is a Go routine started by the system - * bool: is a background Go routine - * uvarint: approximate time the go routine last started waiting (nanoseconds since the Epoch) - * string: textual reason why it is waiting - * uvarint: context pointer of currently running frame - * uvarint: address of os thread descriptor (M) - * uvarint: top defer record - * uvarint: top panic record - -Possible statuses: - * 0 = idle - * 1 = runnable - * 3 = syscall - * 4 = waiting - -The wait fields must be present in all cases, but they only mean something if the status is "waiting". - -# stack frame - * uvarint: stack pointer (lowest address in frame) - * uvarint: depth in stack (0 = top of stack) - * uvarint: stack pointer of child frame (or 0 if none) - * string: contents of stack frame - * uvarint: entry pc for function - * uvarint: current pc for function - * uvarint: continuation pc for function (where function may resume, if anywhere) - * string: function name - * fieldlist: list of kind and offset of pointer-containing fields in this frame - -# dump params - - * bool: big endian - * uvarint: pointer size in bytes - * uvarint: starting address of heap - * uvarint: ending address of heap - * uvarint: thechar = architecture specifier - * string: GOEXPERIMENT environment variable value - * uvarint: runtime.ncpu - -# finalizer - * uvarint: address of object that has a finalizer - * uvarint: pointer to FuncVal describing the finalizer - * uvarint: PC of finalizer entry point - * uvarint: type of finalizer argument - * uvarint: type of object - -This finalizer has been registered with the runtime system, but the object to which it refers was either reachable as of the most recent GC or allocated since the most recent GC. - -# itab - * uvarint: Itab address - * uvarint: address of type descriptor for contained type - -# osthread (M) - * uvarint: address of this os thread descriptor - * uvarint: Go internal id of thread - * uvarint: os's id for thread - -# memstats - -Dumps the first 26 fields of [MemStats](https://pkg.go.dev/runtime/#MemStats). All fields are dumped with a uvarint except the 25th which is dumped with 256 uvarints. - -# queuedfinalizer - * uvarint: address of object that has a finalizer - * uvarint: pointer to FuncVal describing the finalizer - * uvarint: PC of finalizer entry point - * uvarint: type of finalizer argument - * uvarint: type of object - -This finalizer is ready to run - the object to which it refers is unreachable. The runtime system just hasn't gotten around to running it yet. - -# data - * uvarint: address of the start of the data segment - * string: contents of the data segment - * fieldlist: kind and offset of pointer-containing fields in the data segment. - -# bss - -Same format as data, but for the bss segment. - -# defer - * uvarint: defer record address - * uvarint: containing goroutine - * uvarint: argp - * uvarint: pc - * uvarint: FuncVal of defer - * uvarint: PC of defer entry point - * uvarint: link to next defer record - -# panic - * uvarint: panic record address - * uvarint: containing goroutine - * uvarint: type ptr of panic arg eface - * uvarint: data field of panic arg eface - * uvarint: ptr to defer record that's currently running - * uvarint: link to next panic record - -# alloc/free profile record - * uvarint: record identifier - * uvarint: size of allocated object - * uvarint: number of stack frames. For each frame: - * - string: function name - * - string: file name - * - uvarint: line number - * uvarint: number of allocations - * uvarint: number of frees - -# alloc sample record - * uvarint: address of object - * uvarint: alloc/free profile record identifier \ No newline at end of file diff --git a/heapdump15-through-heapdump17.md b/heapdump15-through-heapdump17.md index 800464de..f555a929 100644 --- a/heapdump15-through-heapdump17.md +++ b/heapdump15-through-heapdump17.md @@ -1,206 +1,4 @@ -Heap dump format for other versions: +The Go wiki on GitHub has moved to go.dev (#61940). - * [[heapdump13]] - * [[heapdump14]] +Try or . -# Introduction - -Go 1.5 has a runtime/debug.WriteHeapDump function that writes all objects in the heap plus additional info (roots, goroutines, finalizers, etc.) to a file. The format of this file is specified here. - -# Details - -The file starts with the bytes of the string "go1.5 heap dump\n". -This description also applies to files starting with "go1.6 heap dump\n" and "go1.7 heap dump\n". The go1.6 format is identical to 1.5, and the go1.7 format has one small change described below. - -The rest of the file is a sequence of records. Records can be of several different kinds. Records will contain the following primitives: - * uvarint - a 64-bit unsigned integer encoded as in encoding/binary.{Put,Read}Uvarint - * string - a uvarint-encoded length followed by that many bytes of data - * bool - a uvarint-encoded 0 for false or 1 for true - * fieldlist - a description of the pointer-bearing portions of a memory region. It consists of repeated pairs of uvarints encoding a field kind and a field offset, followed by an end-of-list marker. The only possible kind is 1=Ptr. Earlier versions of the heap dump could contain 2=Iface and 3=Eface, but the runtime no longer tracks that information, so it is not present in the dump. Interface values appear as a pair of pointers. 0=Eol is the end of list marker. The end of list marker does not have a corresponding offset. - -Each record starts with a uvarint-encoded integer describing the type of the record: - * 0 = EOF - * 1 = object - * 2 = otherroot - * 3 = type - * 4 = goroutine - * 5 = stack frame - * 6 = dump params - * 7 = registered finalizer - * 8 = itab - * 9 = OS thread - * 10 = mem stats - * 11 = queued finalizer - * 12 = data segment - * 13 = bss segment - * 14 = defer record - * 15 = panic record - * 16 = alloc/free profile record - * 17 = alloc stack trace sample - -The remaining fields of each record are type-dependent and are described below. - -# EOF - -An EOF record has no fields and must appear last. - -# object - * uvarint: address of object - * string: contents of object - * fieldlist: describes pointer-containing fields of the object - -The size of the contents string is the size of the containing sizeclass, not the size of the object itself. As such, contents size may be somewhat bigger than the contained object's type. - -# otherroot - * string: textual description of where this root came from - * uvarint: root pointer - -# type - * uvarint: address of type descriptor - * uvarint: size of an object of this type - * string: name of type - * bool: whether the data field of an interface containing a value of this type has type T (false) or *T (true) - -# goroutine (G) - - * uvarint: address of descriptor - * uvarint: pointer to the top of stack (the currently running frame, a.k.a. depth 0) - * uvarint: go routine ID - * uvarint: the location of the go statement that created this goroutine - * uvarint: status - * bool: is a Go routine started by the system - * bool: is a background Go routine - * uvarint: approximate time the go routine last started waiting (nanoseconds since the Epoch) - * string: textual reason why it is waiting - * uvarint: context pointer of currently running frame - * uvarint: address of os thread descriptor (M) - * uvarint: top defer record - * uvarint: top panic record - -Possible statuses: - * 0 = idle - * 1 = runnable - * 3 = syscall - * 4 = waiting - -The wait fields must be present in all cases, but they only mean something if the status is "waiting". - -# stack frame - * uvarint: stack pointer (lowest address in frame) - * uvarint: depth in stack (0 = top of stack) - * uvarint: stack pointer of child frame (or 0 if none) - * string: contents of stack frame - * uvarint: entry pc for function - * uvarint: current pc for function - * uvarint: continuation pc for function (where function may resume, if anywhere) - * string: function name - * fieldlist: list of kind and offset of pointer-containing fields in this frame - -# dump params - - * bool: big endian - * uvarint: pointer size in bytes - * uvarint: starting address of heap - * uvarint: ending address of heap - * string: architecture name - * string: GOEXPERIMENT environment variable value - * uvarint: runtime.ncpu - -# finalizer - * uvarint: address of object that has a finalizer - * uvarint: pointer to FuncVal describing the finalizer - * uvarint: PC of finalizer entry point - * uvarint: type of finalizer argument - * uvarint: type of object - -This finalizer has been registered with the runtime system, but the object to which it refers was either reachable as of the most recent GC or allocated since the most recent GC. - -# itab - * uvarint: Itab address - * uvarint: address of type descriptor for contained type - * Up to go1.6, the type is always a pointer type, and represents the type of the itab.data field. - * From go1.7 and beyond, the type is the type stored in the interface. To decide whether the itab.data field is T or *T requires looking at the last boolean in the referenced type's descriptor. - -# osthread (M) - * uvarint: address of this os thread descriptor - * uvarint: Go internal id of thread - * uvarint: os's id for thread - -# memstats - -Records the following fields of [runtime.MemStats](https://pkg.go.dev/runtime/#MemStats): - * uvarint: Alloc - * uvarint: TotalAlloc - * uvarint: Sys - * uvarint: Lookups - * uvarint: Mallocs - * uvarint: Frees - * uvarint: HeapAlloc - * uvarint: HeapSys - * uvarint: HeapIdle - * uvarint: HeapInuse - * uvarint: HeapReleased - * uvarint: HeapObjects - * uvarint: StackInuse - * uvarint: StackSys - * uvarint: MSpanInuse - * uvarint: MSpanSys - * uvarint: MCacheInuse - * uvarint: MCacheSys - * uvarint: BuckHashSys - * uvarint: GCSys - * uvarint: OtherSys - * uvarint: NextGC - * uvarint: LastGC - * uvarint: PauseTotalNs - * 256 uvarints: PauseNs - * uvarint: NumGC - -# queuedfinalizer - * uvarint: address of object that has a finalizer - * uvarint: pointer to FuncVal describing the finalizer - * uvarint: PC of finalizer entry point - * uvarint: type of finalizer argument - * uvarint: type of object - -This finalizer is ready to run - the object to which it refers is unreachable. The runtime system just hasn't gotten around to running it yet. - -# data - * uvarint: address of the start of the data segment - * string: contents of the data segment - * fieldlist: kind and offset of pointer-containing fields in the data segment. - -# bss - -Same format as data, but for the bss segment. - -# defer - * uvarint: defer record address - * uvarint: containing goroutine - * uvarint: argp - * uvarint: pc - * uvarint: FuncVal of defer - * uvarint: PC of defer entry point - * uvarint: link to next defer record - -# panic - * uvarint: panic record address - * uvarint: containing goroutine - * uvarint: type ptr of panic arg eface - * uvarint: data field of panic arg eface - * uvarint: ptr to defer record that's currently running - * uvarint: link to next panic record - -# alloc/free profile record - * uvarint: record identifier - * uvarint: size of allocated object - * uvarint: number of stack frames. For each frame: - * string: function name - * string: file name - * uvarint: line number - * uvarint: number of allocations - * uvarint: number of frees - -# alloc sample record - * uvarint: address of object - * uvarint: alloc/free profile record identifier \ No newline at end of file diff --git a/heapdump15.md b/heapdump15.md index 9e876026..399f87e3 100644 --- a/heapdump15.md +++ b/heapdump15.md @@ -1 +1,4 @@ -Page moved to https://github.com/golang/go/wiki/heapdump15-through-heapdump17 \ No newline at end of file +The Go wiki on GitHub has moved to go.dev (#61940). + +Try or . +