if versionString, ok := pathSections["key"]; ok {
// Do something
}
Using panic() instead of log.Fatal displays a helpful stacktrace in the console
Equiv of php substr()
// You can edit this code!
// Click here and start typing.
package main
import "fmt"
func main() {
s1 := "This is a string"
s2 := s1[0:7] + " the second " + s1[10:16]
fmt.Println(s1)
fmt.Println(s2)
}
Declaring static maps and a useful library for humanizing things: https://github.com/dustin/go-humanize/blob/master/bytes.go
You can install the following tools with this command
apt-get install linux-tools-common linux-tools-generic linux-tools-moby
To get the latency of the scheduler intervals (might be useful if you're running too many goroutines as this will slow the code down as it will be doing more context switching that running the actual application
perf sched
You can use strace to get the syscalls that your application makes
strace -c ./your-binary
Get what libraries the binary links to. Will also return if its a statically compiled binary.
ldd ./your-binary
Testing Article:
https://medium.com/@povilasve/go-advanced-tips-tricks-a872503ac859
Play Blokr Now FREE!
blokr.io the web game where you can eat other blocks!