2025-02-09 21:10:22 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2025-02-09 21:36:17 +01:00
|
|
|
"runtime"
|
2025-02-09 21:10:22 +01:00
|
|
|
"github.com/BurntSushi/toml"
|
2025-02-09 21:36:17 +01:00
|
|
|
"os"
|
2025-02-09 21:10:22 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
type Config struct {
|
|
|
|
What string
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
2025-02-09 21:36:17 +01:00
|
|
|
message := runtime.Version()
|
|
|
|
if len(os.Args) > 1 {
|
|
|
|
message = os.Args[1]
|
|
|
|
}
|
2025-02-09 21:10:22 +01:00
|
|
|
var conf Config
|
|
|
|
toml.Decode("What = 'world'\n", &conf)
|
2025-02-09 21:36:17 +01:00
|
|
|
fmt.Printf("hello %v from %s\n", conf.What, message)
|
2025-02-09 21:10:22 +01:00
|
|
|
}
|