Complete the code to print the Go version using the runtime package.
package main import ( "fmt" "runtime" ) func main() { fmt.Println(runtime.[1]()) }
The runtime.Version function returns the Go version as a string.
Complete the command to build a Go program into an executable.
go [1] main.gogo run which compiles and runs immediatelygo test which runs tests instead of buildingThe go build command compiles the source code into an executable binary.
Fix the error in the command to run tests with verbose output.
go test [1] ./...--verbose which are not supported-verbose=true which is invalid syntaxThe correct flag for verbose output in go test is -v.
Fill both blanks to create a map of word lengths for words longer than 3 characters.
words := []string{"go", "tool", "chain", "test"}
lengths := make(map[string]int)
for _, word := range words {
if len(word) [2] 3 {
lengths[word] = [1]
}
}word instead of len(word) for the map value< instead of > for filteringThe loop uses len(word) to get length and filters words with length greater than 3 using >.
Fill all three blanks to create a map of uppercase words to their lengths for words longer than 3 characters.
words := []string{"go", "tool", "chain", "test"}
lengths := make(map[string]int)
for _, [2] := range words {
if len([2]) [3] 3 {
lengths[[1]([2])] = len([2])
}
}Use strings.ToUpper as the function for uppercase keys, word as the loop variable, and > for the length condition.