Created
February 20, 2018 22:39
-
-
Save cemeng/4b9141d14b9209c2cbddb24126633783 to your computer and use it in GitHub Desktop.
Golang Study Notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
My Golang study note |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
22/2
dep -> dependency management in go https://github.com/golang/dep - does blue team use this?
started following gowebexamples.com
unable to start web server on port 80 - wondering why, using log.Fatal helps
log.Fatal(http.ListenAndServe(":80", nil))
Middleware
TIL: you can pass in a function as a param to a function.
A function has a type - the type is determined by the function signature.
https://gowebexamples.com/basic-middleware/
Basically middleware is just a function that takes http.HandlerFunc and return http.HandlerFunc
Advanced Middleware
create a middleware type
type Middleware func(http.HandlerFunc) http.HandlerFunc
and you can chain em - you need to create your own Chain method urgh