-
-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
release-3.1.0: internal/server/server.go:19:12: pattern out/*: no matching files found #231
Comments
Thanks for the quick feedback, I've added one line of annotation at the beginning of the file Before doing that, you need to set up the frontend development environment first, please refer to: https://github.com/TimothyYe/godns?tab=readme-ov-file#setup-the-frontend-development-environment I'll update the |
I'm also seeing this in 3.1.2 or is the npm stuff a hard requirement now (please don't make it)?
|
I'll update the Makefile with two available building commands: make all #builds all the projects, including the frontend project & the backend project
make build # only build the backend project |
I was working on it a bit: jlsalvador@0765d10 A merge request will be submitted when it's completed. |
@diizzyy If you'd like to build it with your scripts, here is the workaround: mkdir -p ./internal/server/out
touch ./internal/server/out/index.html
GO111MODULE=on go build cmd/godns/godns.go |
@TimothyYe |
@diizzyy Yes, it depends on whether you want to include the frontend project at compile time. |
There's a strict rule that no internet access is allowed during builds (which makes sense) however that makes npm more or less a no go (or a major pain I'm not willing to spend time on) so unless we can get a precompiled frontend there's not going to be packaged version with the frontend. |
@diizzyy Thanks for the explanation, however, I still have a bit of confusion. If there is no internet connection during builds, when compiling this Go project, if new modules are introduced in the code, they will also be downloaded from the internet during the compilation period. How is this achieved? |
By build I guess I should say compilation as packaging is divided into different stages ( https://docs.freebsd.org/en/books/porters-handbook/book/#options-targets ). See also: |
@diizzyy I asked ChatGPT for an example of a Makefile to build the port, which includes npm and Go as dependencies. I'm not sure if it will be helpful: # Ports metadata
PORTNAME= myproject
DISTVERSION= 1.0.0
CATEGORIES= www
MAINTAINER= [email protected]
COMMENT= An example Go project with embedded Next.js static files
LICENSE= MIT
BUILD_DEPENDS= npm:www/npm \
go:lang/go
USES= go:modules
# Use the post-extract target to install Node.js dependencies and build the Next.js project
post-extract:
@cd ${WRKSRC}/web && ${SETENV} ${MAKE_ENV} npm install
@cd ${WRKSRC}/web && ${SETENV} ${MAKE_ENV} npm run build
# Use the pre-build target to move the Next.js build output to the location expected by the Go code
pre-build:
@${MKDIR} ${WRKSRC}/internal/server
@${MV} ${WRKSRC}/web/out/* ${WRKSRC}/internal/server
# Use the do-build target to build the Go project, embedding the Next.js static files
do-build:
@cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} go build -o ${PORTNAME} cmd/${PORTNAME}/main.go
# Use the do-install target to install the built Go binary
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/${PORTNAME}
.include <bsd.port.mk> Key Points:
|
npm is more complicated than that (which is why you rarely see it packaged in any repo). See below for example |
Describe the bug
You forget the "out" directory for the release 3.1.0.
The makefile "build" does not compiles the web, the "out" directory. What do you think about add a dependency to a new target? Maybe a web?
The new target could execute:
Another alternative could be to write an
embed.go
in the project root, in order to include the folder "web/out".Thoughts?
The frequency of this issue
Steps to Reproduce
Download latest release, try to compile it.
Your GoDNS configuration
Expected behavior
A successful 3.1.0 binary.
Screenshots
Environment (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: