recentpopularlog in
« earlier  
Validating struct fields made easy in GO language – Shivaraj arali – Medium
In code it is often necessary to validate that a given value is valid before using it for something. but it can get significantly more complex, especially when dealing with structs. Package validator…
go  golang  field  validation  article  important 
9 hours ago
Twitter
Mon précieux <3
3 days ago
Twitter
I was asked in a sales meeting why Vault is open source, and this was a fun coincidence… HashiCorp is committed to…
4 days ago
cmd/go: Make it easier to embed compiled git SHA into binary · Issue #22147 · golang/go
If I compile Go from source and run go version, I get output like this: go version devel +475d92ba4d Thu Oct 5 10:50:18 2017 +0000 darwin/amd64 I would love to get the same output in my programs. Specifically, I'm trying to debug a repor...
go  golang  git  version  ld  compilation  describe 
4 days ago
Using environment variables in Go
Parsing environment variables with Go is simple, thanks to the standard library os package.
os.Getenv() gets an environment variable. It’s not possible to determine not set or empty. Use os.LookupEnv() to be able to do that.
foo := os.Getenv("FOO") os.Setenv() sets an environment variable.
os.Setenv("FOO", "Something") os.Unsetenv() unsets an environment variable.
os.Unsetenv("FOO") os.Clearenv() unsets all environment variables.
os.Clearenv() os.Environ() returns a slice of stri...
blog  design  color  light  dark  mode  example  font  readability 
4 days ago
Using Command Line Flags in Go
There are many ways to process CLI flags using Go. The first option is to not use any library at all, and inspect os.Args. The second option is to use the standard library flag package. The third option is to use one of the many 3rd party CLI libs out there, like Cobra.
Let’s talk about the second option: using the standard library flag, as it offers many benefits over raw parsing of os.
go  golang  flag  bestpractices  article  important  native 
4 days ago
« earlier      
per page:    204080120160

Copy this bookmark:





to read