Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Docker build fails with: `version "v2.0.0" invalid: should be v0 or v1, not v2`

未关闭
#1,514 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
38/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
docker, go

调研方向

先从 Dockerfile 和 scripts/build.sh 开始,然后检查构建日志中报告的 go.mod 条目,以及 ANSWER_MODULE 是如何传入构建的。使用 ANSWER_MODULE=github.com/apache/[email protected] 重现失败,并检查模块路径和发布版本管理。对于文档中所述的 v2.0.0 输入,custom Docker build 成功完成即表示完成。

由索引模型根据 Issue 内容生成。

描述

bug

Describe the bug

Custom build using ANSWER_MODULE failing with: replace github.com/apache/answer: version "v2.0.0" invalid: should be v0 or v1, not v2

To Reproduce

Steps to reproduce the behavior:

  1. Specify ARG ANSWER_MODULE=github.com/apache/[email protected] and build apache answer
  2. See build fail with error

Expected behavior

A working build.

CI/CD log

#15 43.92 go: downloading github.com/apache/answer-plugins/reviewer-basic v1.0.8
#15 44.20 go: added github.com/apache/answer-plugins/reviewer-basic v1.0.8
#15 44.21 [go mod edit -replace github.com/apache/answer=github.com/apache/[email protected]]
#15 44.23 [go mod tidy]
#15 44.24 go: errors parsing go.mod:
#15 44.24 go.mod:73: replace github.com/apache/answer: version "v2.0.0" invalid: should be v0 or v1, not v2
#15 44.24 build failed exit status 1
#15 ERROR: process "/bin/bash -c /scripts/build.sh" did not complete successfully: exit code: 1

Dockerfile

# Initialize /usr/bin/answer
# INFO: Replace version
FROM docker.io/apache/answer:2.0.0 AS answer-builder
# INFO: Replace version
FROM code.forgejo.org/oci/golang:1.26-alpine3.23 AS golang-builder
COPY --from=answer-builder /usr/bin/answer /usr/bin/answer

# Set build time variables
# INFO: Replace version
ARG PNPM_VERSION=10.32.1
ARG ANSWER_MODULE=github.com/apache/[email protected]

# Install dependencies
RUN apk --no-cache add \
    build-base git bash nodejs npm go && \
    npm install -g pnpm@${PNPM_VERSION}

# Build /usr/bin/new_answer
COPY scripts/ /scripts
RUN chmod 755 /scripts/*.sh
RUN ["/bin/bash","-c","/scripts/build.sh"]

# Defaults from https://github.com/apache/answer/blob/main/Dockerfile
# INFO: Replace version
FROM code.forgejo.org/oci/alpine:latest
LABEL maintainer="[email protected]"

ARG TIMEZONE
ENV TIMEZONE=${TIMEZONE:-"Asia/Shanghai"}

RUN apk update \
    && apk --no-cache add \
        bash \
        ca-certificates \
        curl \
        dumb-init \
        gettext \
        openssh \
        sqlite \
        gnupg \
        tzdata \
    && ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
    && echo "${TIMEZONE}" > /etc/timezone

# Defaults from https://answer.apache.org/docs/plugins/#build-with-plugin-from-answer-base-image
COPY --from=golang-builder /usr/bin/new_answer /usr/bin/answer
COPY --from=answer-builder /data /data
COPY --from=answer-builder /entrypoint.sh /entrypoint.sh
RUN chmod 755 /entrypoint.sh

VOLUME /data
ENTRYPOINT ["/entrypoint.sh"]

Problem

As far as I understand, go requires a /v2 suffix after a major version bump. Also see this.

If you want met to submit a PR, please let me know, but I think this is better handled by maintainers. Also my understanding of go is limited so this problem description might not be 100% accurate.

Platform

  • Device: n.a
  • OS: n.a
  • Browser and version: n.a
  • Version: v2.0.0
主要语言
Go
星标
15.7k
派生
1.4k
平均合并
1 天 20 小时
30 天内合并 PR
6

环境准备

我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/answer 的其他 Issue

查看 apache/answer 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。