It seems that adding Windows support updated the CFLAGS line to #cgo CFLAGS: -I"/usr/include/postgresql/server" -fpic has added quotes which were not present previously, causing what was the end of the line to be the middle. The path here is provided from the call to pg_config --includedir-server which includes a newline character at the end, since this newline is no longer the final character in the declaration this produces a syntax error. This is fixed by getcorrectpath for Windows only, leaving the Linux version failing.
Here is a Dockerfile for reproducing this issue:
FROM golang:1.13
RUN apt-get update && \
apt-get -y install postgresql-server-dev-11 && \
go get -u github.com/microo8/plgo/plgo && \
plgo /go/src/github.com/microo8/plgo/example/.
By trimming the newline character from the end of the path for the non-Windows version of getcorrectpath I am able to build successfully. (https://github.com/microo8/plgo/pull/33) Not sure if I am missing something here since based on my understanding I'd expect any Linux build to hit the same problem and I haven't been able to find any other reference to this error.
It seems that adding Windows support updated the CFLAGS line to
#cgo CFLAGS: -I"/usr/include/postgresql/server" -fpic
has added quotes which were not present previously, causing what was the end of the line to be the middle. The path here is provided from the call topg_config --includedir-server
which includes a newline character at the end, since this newline is no longer the final character in the declaration this produces a syntax error. This is fixed bygetcorrectpath
for Windows only, leaving the Linux version failing.Here is a Dockerfile for reproducing this issue:
Running this produces the following error:
By trimming the newline character from the end of the path for the non-Windows version of
getcorrectpath
I am able to build successfully. (https://github.com/microo8/plgo/pull/33) Not sure if I am missing something here since based on my understanding I'd expect any Linux build to hit the same problem and I haven't been able to find any other reference to this error.