Closed velo closed 6 years ago
what prints pg_config --includedir-server
?
$ pg_config --includedir-server
/usr/include/postgresql/9.6/server
ls /usr/include/postgresql/9.6/server
access
bootstrap
c.h
catalog
commands
common
datatype
dynloader.h
executor
fe_utils
fmgr.h
foreign
funcapi.h
getaddrinfo.h
getopt_long.h
lib
libpq
mb
miscadmin.h
nodes
optimizer
parser
pg_config.h
pg_config_ext.h
pg_config_manual.h
pg_config_os.h
pg_getopt.h
pg_trace.h
pgstat.h
pgtar.h
pgtime.h
plperl.h
plpgsql.h
plpy_util.h
plpython.h
port
port.h
portability
postgres.h
postgres_ext.h
postgres_fe.h
postmaster
ppport.h
regex
replication
rewrite
rusagestub.h
snowball
storage
tcop
tsearch
utils
windowapi.h
@velo - did you manage to resolve this?
I spent the past few days trying to figure it out, and messing around with all of my postgres header filers etc with no luck.
Once I read the code for plgo
though the cause was pretty clear! plgo
tries to find its own source code by examining the env variable GOPATH
- however as of Go I think 1.8, it is no longer necessary to set this, and Go itself defaults to $HOME/go
. This code fails though, because it looks for the env variable which isn't set.
To make matter worse, the error it returns suggests updating with ./...
which won't work, as it needs to build the examples, which in turn need to be built by plgo
.
The referenced PR should fix most of these cases.
You can also workaround by setting GOPATH
before invoking, e.g.:
GOPATH=$HOME/go plgo .
Thanks for the info :) I didn't know that GOPATH
isn't required anymore. I can try to make it so that it doesn't read its source code, but it will be embedded in plgo tool.
Hi @microo8 - not sure if you saw, but I submitted a small PR that should fix the current issue: https://github.com/microo8/plgo/pull/10
I considered sending a PR to embed the code instead, https://github.com/jteeuwen/go-bindata is one library that works well, however I decided not to as a user will still probably want pl.go
installed in the right place so that code editors such as Visual Studio Code etc can pick up all of the public structures / methods etc for code completion - and that it would probably be worse to have the behaviour of the plgo
to use a different file.
That does the trick
GOPATH=$HOME/go plgo .
I installed
postgresql-server-dev-all
Then I run
go get -u github.com/microo8/plgo/plgo
.After that, I downloaded the example from github https://github.com/microo8/plgo/blob/master/example/example_methods.go
When I run
~/go/bin/plgo .
I got the following result:I follow the instructions and run
go get -u github.com/microo8/plgo/...
Am I missing something obvious?