/explore
|
You are here |
rakyll.org | ||
| | | | |
golb.hplar.ch
[AI summary] This article explains how to set up HTTP over TLS on a localhost server using Go, covering self-signed certificates and the mkcert tool to avoid browser warnings. |
|
| | | | | ||
| | | | |
www.integralist.co.uk
Introduction Four ways to skin a cat How does the adapter work? Why is this interesting? Summary/Breakdown Introduction Here is some code that demonstrates the typical 'hello world' for a Go based web server: package main import ( "fmt" "net/http" ) func handler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Hello %s", r.URL.Path[1:]) } func main() { http.HandleFunc("/World", handler) http.ListenAndServe(":8080", nil) } Note: http://localhost:8080/World will return Hello World For most people,... |
|
| | | | | ||
| | | | |
pauladamsmith.com
This is a simple and easily generalizable way to put an upper-bound on the maximum number of simultaneous clients to a Go net/http server or handler. The idea is to use a counting semaphore, modeled with a buffered channel, to cause new clients to... |
|
| | | | | ||
| | | | |
blog.nuculabs.de
Hi In this article I want to highlight a simple pattern for sorting a slice in Go on multiple keys. Given the following structure, let's say we want to sort it in ascending order after Version, Generation and Time. 1 2 3 4 5 type TheStruct struct { Generation int Time int Version int } The way we sort slices in Go is by using the sort interface or one of the sort.Slice functions. To sort the slice after the above criteria we'll call slice.Sort with the following function. |
|
| | | |||