Yoshiki Shibata (10) [Avatar] Offline
#1
The Chapter 2 requires some additional software: Postgres and https://github.com/lib/pq. So it would be better to have some instructions for installing these software.
Anonymous (122) [Avatar]
#2
What are you having issues with? If you want I can write a small guide on what I did to get it to work?
Anonymous (122) [Avatar]
#3
I'll be getting into this during the chapter on storing data (Chapter 7). Hang on! smilie
Sau Sheong (20) [Avatar] Offline
#4
Hi,

I've made changes in Chapter 2 during the MEAP update, there will be some instructions for setting up PostgreSQL.
52599 (1) [Avatar] Offline
#5
First of all, thank you for this wonderful book, I look forward to ready all the chapters.

I have a question regarding the following errors I'm getting from Chapter 2:

ERROR 2015/04/19 11:34:23 utils.go:100: pq: password authentication failed for user "postgres" Cannot create user

And as Root, I get the following error

ERROR 2015/04/19 12:26:50 utils.go:100: pq: password authentication failed for user "root" Cannot find user
ERROR 2015/04/19 12:27:05 utils.go:100: pq: password authentication failed for user "root" Cannot create user

So, something my PostgreSQL set up or maybe in the data.go is not correct.
I have not changed anything in data.go, and it builds fine with go build, not errors, not new Records are created.

utils.go used data.Session, that uses db()

func db() (database *sql.DB) {
database, err := sql.Open("postgres", "dbname=chitchat sslmode=disable")
if err != nil {
log.Fatal(err)
}
return
}
// the latter fails to connect, from I understanding, but I don't see where authentication is configured?
And it seems to use the OS user running ./chitchat process!

jfs.world (109) [Avatar] Offline
#6
52599 wrote:
// the latter fails to connect, from I understanding, but I don't see where authentication is configured?
And it seems to use the OS user running ./chitchat process!



yup, same thing here as well. Never really thought about it... but I guess that's a sane default if the user isn't provided in the setup?

To configure authentication, simply provide "user=", and "password=" to the setup string. So eg.
database, err := sql.Open("postgres", "dbname=chitchat sslmode=disable user=pgsql password=YOUR_PASS") 


Great work on the chapter, btw!
plod (6) [Avatar] Offline
#7
For the life of me I can't get this app to work, and it seems to be postgres related. Newest error in log (after setting up username and password) is :


ERROR 2016/10/21 20:07:25 utils.go:100: pq: permission denied for relation users Cannot create user