Declaring global variables that are not used does not report errors
# command-line-arguments
.\main.go:4:6: a declared but not used
package main
import “fmt”
func main(){
var a string=”hhh”;
var b,c int =1,2
fmt.Println(b,c);
}
Correct writing style:
package main
import “fmt”
func main(){
// var a string=”hhh”;
var b,c int =1,2
fmt.Println(b,c);
}
# command-line-arguments
.\main.go:4:6: a declared but not used
package main
import “fmt”
func main(){
var a string=”hhh”;
var b,c int =1,2
fmt.Println(b,c);
}
Correct writing style:
package main
import “fmt”
func main(){
// var a string=”hhh”;
var b,c int =1,2
fmt.Println(b,c);
}
Read More:
- [Solved] .\main.go:3:6: missing function body .\main.go:4:1: syntax error: unexpected semicolon or newline be
- [Solved] Golang Error: main.go:5:2: package go_code/chapter10/factory/model is not in GOROOT
- [Solved] Error running ‘go build myfir_go_project‘: Cannot run program
- Go Language Error: main redeclared in this block [How to Solve]
- GO Exception Runnerw.exe: CreateProcess failed with error 21
- [Solved] go cobra Error: required flag(s) “pkg-name” not set
- [GO] The entry file under the main package in golang calls other go file functions and appears undefined
- How to Solve golang test Error: # command-line-arguments [command-line-arguments.test]
- [Solved] Go language gob serialization pointer cannot be addressed Error
- [Solved] Go Get Download Dependency Error: is not using a known version control system
- [Go] Testing when solving go test: warning: no tests to run
- [Solved] VScode Error: build constraints exclude all Go files in syscall\js
- Docker run Error: container_linux.go:235: starting container process caused “process_linux.go:258: appl
- [Solved] Goland sdk Error: The selected directory is not a valid home for Go SDK
- [Solved] Error running XxlJobExecutorHiveApplication. Command line is too long. Shorten the command line via
- SpringBoot Error running ‘Application’: Command line is too long.Shorten command line for
- The method println(boolean) in the type PrintStream is not applicable for the arguments (void) Error
- Implement base64_decode in GO language to solve the problem of illegal characters
- Error running ‘PigSellCabinetApplication’: Command line is too long. Shorten command line for PigSellCabinetApplication or also for Spring Boot default configuration
- [Solved] Error running ‘WebApplication‘: Command line is too long. Shorten command line for WebApplication or