diff --git a/playground/0-file-search/search.go b/playground/0-file-search/search.go index c2d6371..dc4e161 100644 --- a/playground/0-file-search/search.go +++ b/playground/0-file-search/search.go @@ -19,7 +19,7 @@ func TrimSuffix(s, suffix string) string { func main() { var searchPath []string searchPath = append(searchPath, - "/home/starkers/.local/share/Steam/steamapps/compatdata/8500/pfx/drive_c/users/steamuser/My Documents/EVE/logs/Chatlogs") + "~/.local/share/Steam/steamapps/compatdata/8500/pfx/drive_c/users/steamuser/My Documents/EVE/logs/Chatlogs") usr, _ := user.Current() dir := usr.HomeDir diff --git a/playground/2-file-tail/tail.go b/playground/2-file-tail/tail.go new file mode 100644 index 0000000..24285fc --- /dev/null +++ b/playground/2-file-tail/tail.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + + "github.com/hpcloud/tail" +) + +func main() { + + // https://godoc.org/github.com/hpcloud/tail#Config + t, err := tail.TailFile( + "/var/log/nginx.log", + tail.Config{ + Follow: true, + }) + if err != nil { + fmt.Println(err) + } + for line := range t.Lines { + fmt.Println(line.Text) + } +} diff --git a/playground/5-ui-fyne/ui.go b/playground/5-ui-fyne/ui.go new file mode 100644 index 0000000..dcd3da1 --- /dev/null +++ b/playground/5-ui-fyne/ui.go @@ -0,0 +1,14 @@ +package main + +import ( + "fyne.io/fyne/app" + "fyne.io/fyne/widget" +) + +func main() { + a := app.New() + w := a.NewWindow("window title") + + w.SetContent(widget.NewLabel("widget label")) + w.ShowAndRun() +} diff --git a/playground/README.md b/playground/README.md new file mode 100644 index 0000000..67c744b --- /dev/null +++ b/playground/README.md @@ -0,0 +1,3 @@ +Good notes on file handling: + +- https://flaviocopes.com/go-list-files/