Back to questions
JuniorTheoryCommon
What happens when this program is built and run?
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Println(strings.ToUpper("go"), strings.toLower("GO"))
}It does not compile
- Expecting
GO go:importopens only exported names, those starting with a capital letter, sostrings.toLoweris undefined. - Expecting a run-time error or a skipped call: the compiler checks every name first and stops with
undefined: strings.toLower.
- How does an import path differ from the package name used to call it?
- What does a blank import
import _ "pkg"do, and when is it used?