[go-nuts] Minor Error in Tour of Go?

2024-08-14 Thread 'jlfo...@berkeley.edu' via golang-nuts
In the Interfaces section of "A Tour of Go" it says "A value of interface type can hold any value that implements those methods." Shouldn't this be "A variable of interface type can hold any value that implements those methods." Jon -- You received this message because you are subscribed t

Re: [go-nuts] Question About Interface Field in a Structure

2025-05-24 Thread 'jlfo...@berkeley.edu' via golang-nuts
Bingo! This solves the problem. You win the prize! I hope this discussion helps other people facing similar problems. Jon -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an

Re: [go-nuts] Question About Interface Field in a Structure

2025-05-24 Thread 'jlfo...@berkeley.edu' via golang-nuts
keep doing it with interfaces like > > this. It could well be that you'd be better served by avoiding them > > in this instance. But if you must, then learn to enjoy type switches. > > > > On Sat, May 24, 2025, 05:17 'jlfo...@berkeley.edu' via golang-nuts >

[go-nuts] Question About Interface Field in a Structure

2025-05-23 Thread 'jlfo...@berkeley.edu' via golang-nuts
I'm trying to write a program (see below) that passes a slice of structs to a function. One of the struct fields is an interface{} that sometimes will hold a boolean value and other times will hold a string value. To do this, I put either a bool or a string variable in the field. What I want to