100-go-mistakes/06-functions-methods/43-named-result-parameters/main.go
2022-02-04 21:54:30 +01:00

29 lines
507 B
Go

package main
import "io"
func f(a int) (b int) {
b = a
return
}
type locator interface {
getCoordinates(address string) (float32, float32, error)
// getCoordinates(address string) (lat, lng float32, err error)
}
type loc struct{}
func (l loc) getCoordinates(address string) (lat, lng float32, err error) {
return 0, 0, nil
}
func ReadFull(r io.Reader, buf []byte) (n int, err error) {
for len(buf) > 0 && err == nil {
var nr int
nr, err = r.Read(buf)
n += nr
buf = buf[nr:]
}
return
}