Categorygithub.com/tillkuhn/letitgo
repositorypackage
0.0.25
Repository: https://github.com/tillkuhn/letitgo.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# README

= 🥶 Let it Go - My Personal Go Playground :vulcan_salute:

== Get started

Get https://golang.org/doc/install[Go] and - most importantly - install the great https://github.com/golangci/golangci-lint[golangci-lint] and follow the advice of their "Bug Gopher"!

image:https://raw.githubusercontent.com/golangci/golangci-lint/master/assets/go.png[alt=Flower,width=240,height=240]

== Snippets

=== Add recent version of a module


$ go get "github.com/kelseyhightower/envconfig" go get: added github.com/kelseyhightower/envconfig v1.4.0

=== Setup Git Pre-commit hook


== Cobra CLI

=== Refs

=== Install and init


$ go get -u github.com/spf13/cobra@latest

$ cobra-cli init --author "Till Kuhn" Your Cobra application is ready at /Users/tillkuhn/git/hub/letitgo

$ go run main.go A longer description that spans multiple lines and likely contains

=== Add a Cobra Command

.Example to add a 'serve' command, this creates a file cmd/server.go

$ cobra-cli add serve serve created at /Users/tillkuhn/git/hub/letitgo

.Create a dedicated folder / package with at least one .go file for your experiments

$ mkdir charts && echo "package charts" >charts/charts.go printf "package charts\n\nfunc Run() {}" >charts/charts.go

.Open ./cmd/.go and call a public function from your new package

var chartsCmd = &cobra.Command{ Run: func(cmd *cobra.Command, args []string) { fmt.Println("charts called") charts.Run() // Delegate to package function (1st entry point) // (...)

.main() in main.go delegates to Cobra's Execute() function in cmd/root.go

$ cat main.go func main() { cmd.Execute() }

.Run your new command For frequently used command, create a dedicated target in Makefile

$ go run main.go serve Running server

=== Links