Sobes.tech
Junior — Senior

Handle a panic situation in Go

livecode

Task condition

In the example below, an attempt to modify a string element results in a runtime panic. You need to modify the code so that the program successfully outputs the string without errors.

package main

// import "fmt"

func main() {
  txt := "Hello world"
  txt[0] = 'h'
  fmt.Println(txt)
}