Source File
errors.go
Belonging Package
go101.org/nstd
package nstd
import (
)
// Error returns an error that formats as the given text.
// Different from errors.New in the std library, two calls
// to Error return an identical error value if the texts are identical.
func ( string) error {
return errorString{unique.Make()}
}
// Another approach: type errorString string.
// But that results fat interface values.
type errorString struct {
s unique.Handle[string]
}
func ( errorString) () string {
return .s.Value()
}
![]() |
The pages are generated with Golds v0.7.7-preview. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |