github.com/xyproto/u-root@v6.0.1-0.20200302025726-5528e0c77a3c+incompatible/cmds/core/elvish/eval/vars/ro.go (about) 1 package vars 2 3 import ( 4 "errors" 5 ) 6 7 var errRoCannotBeSet = errors.New("read-only variable; cannot be set") 8 9 type ro struct { 10 value interface{} 11 } 12 13 func NewRo(v interface{}) Var { 14 return ro{v} 15 } 16 17 func (rv ro) Set(val interface{}) error { 18 return errRoCannotBeSet 19 } 20 21 func (rv ro) Get() interface{} { 22 return rv.value 23 }