bendemeyer commented on issue #1235:
URL: https://github.com/apache/answer/issues/1235#issuecomment-2613209491

   @LinkinStars One follow-up note on this as well, the second approach you 
outlined (using the older plugin versions with [email protected]) worked exactly as 
described, but the first (using [email protected] with the newest plugins) 
needed some tweaking.
   
   In a golang-builder container based on the `apache/answer:1.4.2-RC2` image, 
when I tried to run this build command:
   ```
   answer build --with 
github.com/apache/answer-plugins/render-markdown-codehighlight --output 
/usr/bin/answer_new
   ```
   
   It errored with the following result:
   ```
   try to build a new answer with plugins:
   github.com/apache/answer-plugins/render-markdown-codehighlight
   [build] build dir: /go/answer_build4074786202
   [go mod tidy]
   go: finding module for package github.com/apache/answer/cmd
   go: finding module for package 
github.com/apache/answer-plugins/render-markdown-codehighlight
   go: found github.com/apache/answer-plugins/render-markdown-codehighlight in 
github.com/apache/answer-plugins/render-markdown-codehighlight v1.0.0
   go: found github.com/apache/answer/cmd in github.com/apache/answer v1.4.1
   go: answer imports
           github.com/apache/answer/cmd: github.com/apache/[email protected]: 
parsing go.mod:
           module declares its path as: github.com/apache/incubator-answer
                   but was required as: github.com/apache/answer
   ```
   
   I noticed it was still trying to pull `[email protected]` as its starting point 
and figured that was the cause of the problem. I found this comment in the 
build script which suggests this is probably expected behavior since 1.4.2 
hasn't actually been released yet:
   > // If user specify a module replacement, use it. Otherwise, use the latest 
version.
   
   I was then able to specify a module replacement using the `ANSWER_MODULE` 
environment variable, and that ultimately did the trick. I updated my 
Dockerfile like so and it works now:
   ```
   FROM apache/answer:1.4.2-RC2 AS answer-source
   
   FROM golang:1.22-alpine AS golang-builder
   
   ENV ANSWER_MODULE="github.com/apache/[email protected]"
   
   ......
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to