I had a misunderstanding of what imports needed to be included, and a fundamental misunderstanding of type vs field.
I added an import of: github.com/jackc/pgconn and changed the declaration to var pgError *pgconn.PgError and now I'm fine. On Mon, Oct 18, 2021 at 10:24 PM Kurtis Rader <kra...@skepticism.us> wrote: > For future readers who stumble upon this thread it would be nice if you > explained the problem and solution in more detail. > > On Mon, Oct 18, 2021 at 8:21 PM Larry Rosenman <larry...@gmail.com> wrote: > >> I'm translating an OLD program from lib/pq to pgx, but when I copy the >> "Error Handling" code, I get: >> ./ambientProgram.go:164:16: db.PgError undefined (type *pgx.Conn has no >> field or method PgError) ./ambientProgram.go:210:18: db.PgError undefined >> (type *pgx.Conn has no field or method PgError) >> >> I get the connection by: >> db, err := pgx.Connect(context.Background(), connStr) >> >> and pass it to: >> func populatedb(macaddr string, db *pgx.Conn, endtime time.Time) >> >> How do I get to the error stuff? >> >> Thanks! >> >> ref: https://github.com/jackc/pgx/issues/1102 >> https://github.com/jackc/pgx/wiki/Error-Handling >> >> -- >> 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 >> email to golang-nuts+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/golang-nuts/41d31af8-d053-40cb-8957-8112ce935ee3n%40googlegroups.com >> <https://groups.google.com/d/msgid/golang-nuts/41d31af8-d053-40cb-8957-8112ce935ee3n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > > > -- > Kurtis Rader > Caretaker of the exceptional canines Junior and Hank > -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 214-642-9640 (c) E-Mail: larry...@gmail.com US Mail: 5708 Sabbia Dr, Round Rock, TX 78665-2106 -- 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 email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CA%2BS%3DX76swN_qJwXVyKXDj18pXPZT2c_HbOTZ1eB84JpYi-%2B%3DHg%40mail.gmail.com.