You have to call Find with a pointer to the slice.
err := db.Find(&users).Error
relevant Gorm documentation: http://jinzhu.me/gorm/crud.html#query
Related Contents:
- Is it OK to leave a channel open?
- How to get the last element of a slice?
- Is there a way to do repetitive tasks at intervals?
- “package XXX is not in GOROOT” when building a Go project
- Is this casting in golang?
- Reason for huge size of compiled executable of Go
- Collect values in order, each containing a map
- For loop of two variables in Go
- goland how to use gofmt?
- Just run single test instead of the whole suite? [duplicate]
- What is the correct way to find the min between two integers in Go?
- What is the meaning of “dot parenthesis” syntax? [duplicate]
- Getting GOPATH error “go: cannot use path@version syntax in GOPATH mode” in Ubuntu 16.04
- How to get a list of values into a flag in Golang?
- Call a function from another package in Go
- Is it possible to initialize slice with specific values?
- Private fields and methods for a struct
- What’s the difference between “
- Fix “should not use basic type string as key in context.WithValue” golint
- Assigning null to JSON fields instead of empty strings
- How do I pass arguments to my handler
- context.WithValue: how to add several key-value pairs
- Unable to build protobuf to go endpoint
- How best do I keep a long running Go program, running?
- How can I generate HTML documents using `godoc`?
- is there a way to create an instance of a struct from a string?
- How do I configure go command to use a proxy?
- How to remove items from a slice while ranging over it?
- Why is my webserver in golang not handling concurrent requests?
- Constant struct in Go
- In Go, how do I capture stdout of a function into a string?
- How can I clear the terminal screen in Go?
- How to convert (type *bytes.Buffer) to use as []byte in argument to w.Write
- What does allocs/op and B/op mean in go benchmark?
- Go gin framework CORS
- Embedding in Go with pointer or with value
- Is there a built in min function for a slice of int arguments or a variable number of int arguments in golang?
- Adding a user-defined language in Notepad++
- What’s the appropriate Go shebang line?
- Reading CSV file in Go
- Is there a `go uninstall`?
- Can I create shared test utilities?
- var vs := in Go
- How to broadcast message using channel
- Golang catch signals
- How to redirect to a url
- Arithmetic in Go templates
- Why am I seeing ZgotmplZ in my Go HTML template output?
- How could I pass a dynamic set of arguments to Go’s command exec.Command?
- What’s the full name for `iota` in golang?