Go compiler spec explanation for "Compile error: val declared and not used"


I you get this compiler error, it's because you have declared a variable that isn't used anywhere in your code. Just use this variable by doing something like
fmt.Println(yourVal)
The analogon for imported and not (yet) used packages is (in this case for the fmt package)
var _ = fmt.Printf // delete before submitting 

Comments

Popular posts from this blog

Tuning ext4 for performance with emphasis on SSD usage

Java 8: Default Interface Implementations, The Diamond Problem, Multiple Inheritance, and Precedence

Tuning ext3 for performance without losing its data integrity potential