Created
October 14, 2025 11:43
-
-
Save JoeGlines/4cecad8db62d9e6d2ad73fd5b2843af6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| ) | |
| func readConfigFile(fileName string) (string, error) { | |
| data, err := os.ReadFile(fileName) | |
| if err != nil { | |
| return "", fmt.Errorf("failed to read config: %w", err) | |
| } | |
| return string(data), nil | |
| } | |
| func main() { | |
| content, err := readConfigFile("config.txt") | |
| if err != nil { | |
| fmt.Println("Error:", err) | |
| return | |
| } | |
| fmt.Println("Config:", content) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment