package main

import (
    "fmt"
)

type Student struct {
    id   int
    name string
}

func Test(s Student) {
    s.id = 1
    s.name = "yy"
}

func Test2(s *Student) {
    s.id = 2
    s.name = "yang"
}
func main() {
    var s Student
    Test(s)
    fmt.Println(s) //{0 }
    Test2(&s)
    fmt.Println(s) //{2 yang}
}

结构体作为函数参数进行传递,是值传递。