We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
func main() { // 硬编码的凭证 username := "admin" password := "secret123" fmt.Printf("Username: %s, Password: %s\n", username, password) }
type Config struct { Username string `json:"username"` Password string `json:"password"` } func main() { username := os.Getenv("APP_USERNAME") password := os.Getenv("APP_PASSWORD") if username == "" || password == "" { fmt.Println("用户名或密码未设置") return } fmt.Printf("Username: %s, Password: %s\n", username, password) }
func main() { configFile, err := ioutil.ReadFile("config.json") if err != nil { fmt.Println("无法读取配置文件:", err) return } var config Config if err := json.Unmarshal(configFile, &config); err != nil { fmt.Println("无法解析配置文件:", err) return } fmt.Printf("Username: %s, Password: %s\n", config.Username, config.Password) }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
lint 解释
错误用法
正确用法
The text was updated successfully, but these errors were encountered: