Where is the source code implementation of string (line) in golang

question: this line of code

str := string(line)

line is of type [] byte. I want to see the implementation of the string function. Where can I see it?

Click the string function to jump to

// string is the set of all strings of 8-bit bytes, conventionally but not
// necessarily representing UTF-8-encoded text. A string may be empty, but
// not nil. Values of string type are immutable.
type string string

string function not found

Mar.20,2021

The concrete implementation of the

string () function is related to the type of parameter that calls it, as well as to the go version.

< hr >

for example, the following code

package main

import "fmt"

func main() {
    b := make([]byte, 10)
    fmt.Println(string(b))
}

you can run go build-gcflags-S xxx.go to view assembly information

...
CALL    runtime.slicebytetostring(SB)
...
Menu