You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
686 B
Go
50 lines
686 B
Go
3 years ago
|
package main
|
||
|
|
||
|
import (
|
||
|
// "net/http"
|
||
|
"net/http/httptest"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
type Dog struct {
|
||
|
name string
|
||
|
age int
|
||
|
owner string
|
||
|
}
|
||
|
|
||
|
func NewDog(name string, age int) *Dog {
|
||
|
return &Dog{name: name, age: age}
|
||
|
}
|
||
|
|
||
|
// SetOwner
|
||
|
func (d *Dog) SetOwner(owner string) {
|
||
|
d.owner = owner
|
||
|
}
|
||
|
|
||
|
// SetDogName
|
||
|
func (d *Dog) SetDogName(name string) {
|
||
|
if d == nil {
|
||
|
d = NewDog(name, 0)
|
||
|
d.name = name
|
||
|
} else {
|
||
|
d.name = name
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (d *Dog) SetOwnerUtf8(name []byte) {
|
||
|
}
|
||
|
|
||
|
func fun1() {
|
||
|
}
|
||
|
|
||
|
func fun1_test() {
|
||
|
d := NewDog("", 1)
|
||
|
NewDog("abc", 12)
|
||
|
// fmt.Printf("abc", 1)
|
||
|
time.Date(12, 12, 12, 33, 12, 55, 22, nil)
|
||
|
|
||
|
d.SetOwnerUtf8([]byte{1})
|
||
|
w := httptest.NewRecorder()
|
||
|
w.Write([]byte{})
|
||
|
}
|