Skip to content

tomcam/goexamples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 

Repository files navigation

Example programs in Go

All of these example Go programs are complete. You can run most or all of them on the Go Playground.

Command-line flags/CLI

  • flagbool.go Illustrates output of the simplest possible command-line boolean flag using the flag package
  • cmdline shows how to parse the command line, with optional subcommands like "init" or "init sitename=test", and also how to retrieve those values later

Directory tree

embed (embedding data in a Go executable)

  • embedlistdir.go creates an executable that embeds a directory, then displays the filenames in that directory at runtime

File handling

Reflection/runtime type identification

JSON

Markdown: Goldmark

Markdown: BurntSushi and BlackFriday (out od date)

  • burntsushitest.go - Use burntsushi to read a TOML file
  • blackfriday - Simple command line programs shoing how to use the Blackfriday parser convert Markdown in to HTML. cli2 also shows how to append file extensions and parse flags

Regex

Slices

  • dirtree.go - Show directory tree as string slice. Allow files & dirs to be excluded

Strings

  • dirtree.go - Show directory tree as string slice. Allow files & dirs to be excluded

Templates

TOML

YAML

About

Complete golang example; sample Go code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published