https://vladimir.varank.in/notes/2023/01/go-runtime-vs-cfs-quota/
for i := range slices {
s := slices[len(slices)-1-i]
......
}
Because no type outside of our package color
can implement the unexported method color.Color.xxxProtected()
, we limit the possible implementations of Color
interface to only values, defined in the color
package.
package color
type Color interface {
xxxProtected()
}
type color string
func (c color) xxxProtected() {}
const (
Red color = "red"
Green color = "green"
Blue color = "blue"
)
https://vladimir.varank.in/notes/2023/09/compile-time-safety-for-enumerations-in-go/