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
package main | |
import "fmt" | |
func main() { | |
fmt.Println("hello world, this is my revision") | |
} |
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
package main | |
import ( | |
"fmt" | |
"reflect" | |
) | |
type Person struct { | |
FirstName string `tag_name:"tag 1"` | |
LastName string `tag_name:"tag 2"` |
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
go list -f '{{.Deps}}' | tr "[" " " | tr "]" " " | xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}' |
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
package main | |
import ( | |
"context" | |
"fmt" | |
"log" | |
"net/http" | |
"os" | |
"os/signal" | |
"syscall" |
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
package main | |
import "fmt" | |
func trace(requestName func() string) func(string) string { | |
return func(text string) string { | |
request := requestName() | |
return fmt.Sprintf("operation: %s, request: %s", request, text) | |
} |
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
import "database/sql" | |
// Resource is type that being used as an object to receive dependency | |
type Resource struct { | |
db *sql.DB | |
} | |
// New is constructor function that do the injection to Resource | |
func New(db *sql.DB) *Resource { | |
r := &Resource{ |
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
package main | |
// Dog struct | |
type Dog struct{} | |
// Speak is receiver method for how the dog speak | |
func (d *Dog) Speak() string { | |
return "woof" | |
} |
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
{ | |
"window.menuBarVisibility": "toggle", | |
"go.formatTool": "goimports", | |
"go.useLanguageServer": true, | |
"window.zoomLevel": 0, | |
"keyboard.dispatch": "keyCode", | |
"[go]": { | |
"editor.formatOnSave": true, | |
"editor.codeActionsOnSave": { | |
"source.organizeImports": true, |
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
package main | |
import ( | |
"errors" | |
"fmt" | |
) | |
var ErrInput = errors.New("wrong input") | |
var ErrConfig = errors.New("invalid config") |
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
package config | |
type Config struct { | |
ConnPsql string | |
} | |
// Load loads a configuration files into Config struct | |
func Load(path string) (Config, error) { | |
return Config{}, nil | |
} |
OlderNewer