package main import ( "fmt" "log" "github.com/spf13/viper" ) func main() { viper.AddConfigPath("config") err := viper.ReadInConfig() if err != nil { log.Fatalf("Error loading file: %v", err.Error()) } api_key := viper.GetString("API_KEY") fmt.Println("Hello world, and API_KEY:", api_key) c := fmt.Sprintf("Test text: %s", "formatted") fmt.Printf("Some text: %s", c) }