This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
["jaagtngoNITvjOeYiy6BDmmAYhlESfZyqJkUuBXXSQA5WujPj0IIeEps0SK3Xdll", "X1g7kCCV1P84RItaLXXRHtUCBQ3udJX4jSOAUjYGwRmq7T4QhMGsRcSFEo6AuUrT", "kPRtbrEKuCWzEADQcuCFfQK03YNHVLNO4oWZ5IH2fy3uQq7OSbHchn4ln91g5TLL"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
power := 1000 | |
fmt.Printf("default power is %d\n", power) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
sliceA := []string{"a", "b", "c"} | |
fmt.Println(sliceA) | |
sliceB := []string{"k", "l", "m", "n"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
array1 := [...]string{"a", "b", "c", "d", "e", "f", "g", "h", "i", "j"} | |
slice1 := array1[2:6] | |
fmt.Println(slice1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
array1 := [...]string{"a", "b", "c", "d", "e", "f"} | |
slice1 := array1[:4] | |
fmt.Println(slice1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
a := 10 | |
f := func() int { a = a * 2; return 5 } | |
x := []int{a, f()} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type SyntaxError struct { | |
msg string // description of error | |
// error occurred after reading Offset bytes, from which line and columnnr can be obtained | |
Offset int64 | |
} | |
func (e *SyntaxError) String() string { return e.msg } | |
if serr, ok := err.(*json.SyntaxError); ok { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PathError records an error and the operation and file path that caused it. | |
type PathError struct { | |
Op string // "open", "unlink", etc. | |
Path string // The associated file. | |
Err error // Returned by the system call. | |
} | |
func (e *PathError) String() string { | |
return e.Op + " " + e.Path + ": "+ e.Err.Error() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
type List []int | |
// 值的方法 | |
func (l List) Len() int { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
type Point struct { | |
x, y float64 | |
} |
NewerOlder