Skip to content

Commit

Permalink
enhance: Upgrade go version from 1.20 to 1.21 (#34759)
Browse files Browse the repository at this point in the history
issue #32982

related pr in master:
pr: #33047
#33150
#33176
#33351
#33202
#33192

Signed-off-by: shaoting-huang <[email protected]>
  • Loading branch information
shaoting-huang authored Jul 22, 2024
1 parent 08c6ab8 commit abc7c84
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 32 deletions.
8 changes: 4 additions & 4 deletions .env
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
IMAGE_REPO=milvusdb
IMAGE_ARCH=amd64
OS_NAME=ubuntu20.04
DATE_VERSION=20231205-43ec2c2
LATEST_DATE_VERSION=20231205-43ec2c2
GPU_DATE_VERSION=20240111-b580aef
LATEST_GPU_DATE_VERSION=20240111-b580aef
DATE_VERSION=20240520-d27db99
LATEST_DATE_VERSION=20240520-d27db99
GPU_DATE_VERSION=20240520-c35eaaa
LATEST_GPU_DATE_VERSION=20240520-c35eaaa
MINIO_ADDRESS=minio:9000
PULSAR_ADDRESS=pulsar://pulsar:6650
ETCD_ENDPOINTS=etcd:2379
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- name: Setup Go environment
uses: actions/[email protected]
with:
go-version: '~1.20.7'
go-version: '~1.21.10'
- name: Mac Cache Go Mod Volumes
uses: actions/cache@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
run:
go: "1.18"
go: "1.21"
skip-dirs:
- build
- configs
Expand Down
9 changes: 4 additions & 5 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,23 @@ Here's a list of verified OS types where Milvus can successfully build and run:
Linux systems (Recommend Ubuntu 20.04 or later):

```bash
go: >= 1.18
go: >= 1.21
cmake: >= 3.18
gcc: 7.5
```

MacOS systems with x86_64 (Big Sur 11.5 or later recommended):

```bash
go: >= 1.18
go: >= 1.21
cmake: >= 3.18
llvm: >= 15
```

MacOS systems with Apple Silicon (Monterey 12.0.1 or later recommended):

```bash
go: >= 1.18 (Arch=ARM64)
go: >= 1.21 (Arch=ARM64)
cmake: >= 3.18
llvm: >= 15
```
Expand Down Expand Up @@ -132,8 +132,7 @@ Confirm that your `GOPATH` and `GOBIN` environment variables are correctly set a
```shell
$ go version
```

Note: go >= 1.18 is required to build Milvus.
Note: go >= 1.21 is required to build Milvus.

#### Docker & Docker Compose

Expand Down
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ OBJPREFIX := "github.com/milvus-io/milvus/cmd/milvus"

INSTALL_PATH := $(PWD)/bin
LIBRARY_PATH := $(PWD)/lib
PGO_PATH := $(PWD)/configs/pgo
OS := $(shell uname -s)
mode = Release

Expand Down Expand Up @@ -63,14 +64,14 @@ milvus: build-cpp print-build-info
@echo "Building Milvus ..."
@source $(PWD)/scripts/setenv.sh && \
mkdir -p $(INSTALL_PATH) && go env -w CGO_ENABLED="1" && \
GO111MODULE=on $(GO) build -ldflags="-r $${RPATH} -X '$(OBJPREFIX).BuildTags=$(BUILD_TAGS)' -X '$(OBJPREFIX).BuildTime=$(BUILD_TIME)' -X '$(OBJPREFIX).GitCommit=$(GIT_COMMIT)' -X '$(OBJPREFIX).GoVersion=$(GO_VERSION)'" \
GO111MODULE=on $(GO) build -pgo=$(PGO_PATH)/default.pgo -ldflags="-r $${RPATH} -X '$(OBJPREFIX).BuildTags=$(BUILD_TAGS)' -X '$(OBJPREFIX).BuildTime=$(BUILD_TIME)' -X '$(OBJPREFIX).GitCommit=$(GIT_COMMIT)' -X '$(OBJPREFIX).GoVersion=$(GO_VERSION)'" \
-tags dynamic -o $(INSTALL_PATH)/milvus $(PWD)/cmd/main.go 1>/dev/null

milvus-gpu: build-cpp-gpu print-gpu-build-info
@echo "Building Milvus-gpu ..."
@source $(PWD)/scripts/setenv.sh && \
mkdir -p $(INSTALL_PATH) && go env -w CGO_ENABLED="1" && \
GO111MODULE=on $(GO) build -ldflags="-r $${RPATH} -X '$(OBJPREFIX).BuildTags=$(BUILD_TAGS_GPU)' -X '$(OBJPREFIX).BuildTime=$(BUILD_TIME)' -X '$(OBJPREFIX).GitCommit=$(GIT_COMMIT)' -X '$(OBJPREFIX).GoVersion=$(GO_VERSION)'" \
GO111MODULE=on $(GO) build -pgo=$(PGO_PATH)/default.pgo -ldflags="-r $${RPATH} -X '$(OBJPREFIX).BuildTags=$(BUILD_TAGS_GPU)' -X '$(OBJPREFIX).BuildTime=$(BUILD_TIME)' -X '$(OBJPREFIX).GitCommit=$(GIT_COMMIT)' -X '$(OBJPREFIX).GoVersion=$(GO_VERSION)'" \
-tags dynamic -o $(INSTALL_PATH)/milvus $(PWD)/cmd/main.go 1>/dev/null

get-build-deps:
Expand All @@ -92,7 +93,7 @@ getdeps:

tools/bin/revive: tools/check/go.mod
cd tools/check; \
$(GO) build -o ../bin/revive github.com/mgechev/revive
$(GO) build -pgo=$(PGO_PATH)/default.pgo -o ../bin/revive github.com/mgechev/revive

cppcheck:
@(env bash ${PWD}/scripts/core_build.sh -l)
Expand Down Expand Up @@ -149,14 +150,14 @@ binlog:
@echo "Building binlog ..."
@source $(PWD)/scripts/setenv.sh && \
mkdir -p $(INSTALL_PATH) && go env -w CGO_ENABLED="1" && \
GO111MODULE=on $(GO) build -ldflags="-r $${RPATH}" -o $(INSTALL_PATH)/binlog $(PWD)/cmd/tools/binlog/main.go 1>/dev/null
GO111MODULE=on $(GO) build -pgo=$(PGO_PATH)/default.pgo -ldflags="-r $${RPATH}" -o $(INSTALL_PATH)/binlog $(PWD)/cmd/tools/binlog/main.go 1>/dev/null

MIGRATION_PATH = $(PWD)/cmd/tools/migration
meta-migration:
@echo "Building migration tool ..."
@source $(PWD)/scripts/setenv.sh && \
mkdir -p $(INSTALL_PATH) && go env -w CGO_ENABLED="1" && \
GO111MODULE=on $(GO) build -ldflags="-r $${RPATH} -X '$(OBJPREFIX).BuildTags=$(BUILD_TAGS)' -X '$(OBJPREFIX).BuildTime=$(BUILD_TIME)' -X '$(OBJPREFIX).GitCommit=$(GIT_COMMIT)' -X '$(OBJPREFIX).GoVersion=$(GO_VERSION)'" \
GO111MODULE=on $(GO) build -pgo=$(PGO_PATH)/default.pgo -ldflags="-r $${RPATH} -X '$(OBJPREFIX).BuildTags=$(BUILD_TAGS)' -X '$(OBJPREFIX).BuildTime=$(BUILD_TIME)' -X '$(OBJPREFIX).GitCommit=$(GIT_COMMIT)' -X '$(OBJPREFIX).GoVersion=$(GO_VERSION)'" \
-tags dynamic -o $(INSTALL_PATH)/meta-migration $(MIGRATION_PATH)/main.go 1>/dev/null

INTERATION_PATH = $(PWD)/tests/integration
Expand Down Expand Up @@ -349,7 +350,7 @@ clean:
milvus-tools: print-build-info
@echo "Building tools ..."
@mkdir -p $(INSTALL_PATH)/tools && go env -w CGO_ENABLED="1" && GO111MODULE=on $(GO) build \
-ldflags="-X 'main.BuildTags=$(BUILD_TAGS)' -X 'main.BuildTime=$(BUILD_TIME)' -X 'main.GitCommit=$(GIT_COMMIT)' -X 'main.GoVersion=$(GO_VERSION)'" \
-pgo=$(PGO_PATH)/default.pgo -ldflags="-X 'main.BuildTags=$(BUILD_TAGS)' -X 'main.BuildTime=$(BUILD_TIME)' -X 'main.GitCommit=$(GIT_COMMIT)' -X 'main.GoVersion=$(GO_VERSION)'" \
-o $(INSTALL_PATH)/tools $(PWD)/cmd/tools/* 1>/dev/null

rpm-setup:
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,21 @@ Check the requirements first.

Linux systems (Ubuntu 20.04 or later recommended):
```bash
go: >= 1.18
go: >= 1.21
cmake: >= 3.18
gcc: 7.5
```

MacOS systems with x86_64 (Big Sur 11.5 or later recommended):
```bash
go: >= 1.18
go: >= 1.21
cmake: >= 3.18
llvm: >= 15
```

MacOS systems with Apple Silicon (Monterey 12.0.1 or later recommended):
```bash
go: >= 1.18 (Arch=ARM64)
go: >= 1.21 (Arch=ARM64)
cmake: >= 3.18
llvm: >= 15
```
Expand Down Expand Up @@ -118,7 +118,7 @@ See [Milvus 2.0 vs. 1.x](https://github.com/milvus-io/milvus/blob/master/milvus2
<table>
<tr>
<td width="30%">
<a href="https://milvus.io/milvus-demos">
<a href="https://milvus.io/milvus-demos">
<img src="https://assets.zilliz.com/image_search_59a64e4f22.gif" />
</a>
</td>
Expand Down
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Milvus 基于 [Apache 2.0 License](https://github.com/milvus-io/milvus/blob/mast
请先安装相关依赖。

```
go: 1.18
go: 1.21
cmake: >=3.18
gcc: 7.5
protobuf: >=3.7
Expand Down
17 changes: 13 additions & 4 deletions build/docker/builder/cpu/amazonlinux2023/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,27 @@ FROM amazonlinux:2023
ARG TARGETARCH

RUN dnf install -y wget g++ gcc gdb libatomic libstdc++-static ninja-build git make zip unzip tar which \
autoconf automake golang python3 python3-pip perl-FindBin texinfo \
autoconf automake python3 python3-pip perl-FindBin texinfo \
pkg-config libuuid-devel libaio perl-IPC-Cmd && \
rm -rf /var/cache/yum/*

ENV GOPATH /go
ENV GOROOT /usr/local/go
ENV GO111MODULE on
ENV PATH $GOPATH/bin:$GOROOT/bin:$PATH
RUN mkdir -p /usr/local/go && wget -qO- "https://go.dev/dl/go1.21.10.linux-$TARGETARCH.tar.gz" | tar --strip-components=1 -xz -C /usr/local/go && \
mkdir -p "$GOPATH/src" "$GOPATH/bin" && \
go clean --modcache && \
chmod -R 777 "$GOPATH" && chmod -R a+w $(go env GOTOOLDIR)

RUN pip3 install conan==1.61.0

RUN echo "target arch $TARGETARCH"
RUN wget -qO- "https://cmake.org/files/v3.24/cmake-3.24.4-linux-`uname -m`.tar.gz" | tar --strip-components=1 -xz -C /usr/local

# https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md
RUN mkdir /opt/vcpkg && \
wget -qO- vcpkg.tar.gz https://github.com/milvus-io/vcpkg/archive/master.tar.gz | tar --strip-components=1 -xz -C /opt/vcpkg && \
wget -qO- vcpkg.tar.gz https://github.com/microsoft/vcpkg/archive/refs/tags/2023.11.20.tar.gz | tar --strip-components=1 -xz -C /opt/vcpkg && \
rm -rf vcpkg.tar.gz

ENV VCPKG_FORCE_SYSTEM_BINARIES 1
Expand All @@ -35,9 +44,9 @@ RUN /opt/vcpkg/bootstrap-vcpkg.sh -disableMetrics && ln -s /opt/vcpkg/vcpkg /usr
RUN vcpkg install azure-identity-cpp azure-storage-blobs-cpp gtest --only-downloads

RUN mkdir /tmp/ccache && cd /tmp/ccache &&\
wget https://dl.fedoraproject.org/pub/epel/9/Everything/`uname -m`/Packages/h/hiredis-1.0.2-1.el9.`uname -m`.rpm &&\
wget https://dl.fedoraproject.org/pub/epel/9/Everything/`uname -m`/Packages/h/hiredis-1.0.2-2.el9.`uname -m`.rpm &&\
wget https://dl.fedoraproject.org/pub/epel/9/Everything/`uname -m`/Packages/c/ccache-4.5.1-2.el9.`uname -m`.rpm &&\
rpm -i hiredis-1.0.2-1.el9.`uname -m`.rpm ccache-4.5.1-2.el9.`uname -m`.rpm &&\
rpm -i hiredis-1.0.2-2.el9.`uname -m`.rpm ccache-4.5.1-2.el9.`uname -m`.rpm &&\
rm -rf /tmp/ccache


Expand Down
2 changes: 1 addition & 1 deletion build/docker/builder/cpu/ubuntu20.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ENV GOPATH /go
ENV GOROOT /usr/local/go
ENV GO111MODULE on
ENV PATH $GOPATH/bin:$GOROOT/bin:$PATH
RUN mkdir -p /usr/local/go && wget -qO- "https://go.dev/dl/go1.20.7.linux-$TARGETARCH.tar.gz" | tar --strip-components=1 -xz -C /usr/local/go && \
RUN mkdir -p /usr/local/go && wget -qO- "https://go.dev/dl/go1.21.10.linux-$TARGETARCH.tar.gz" | tar --strip-components=1 -xz -C /usr/local/go && \
mkdir -p "$GOPATH/src" "$GOPATH/bin" && \
go clean --modcache && \
chmod -R 777 "$GOPATH" && chmod -R a+w $(go env GOTOOLDIR)
Expand Down
2 changes: 1 addition & 1 deletion build/docker/builder/gpu/ubuntu20.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ ENV GOPATH /go
ENV GOROOT /usr/local/go
ENV GO111MODULE on
ENV PATH $GOPATH/bin:$GOROOT/bin:$PATH
RUN mkdir -p /usr/local/go && wget -qO- "https://go.dev/dl/go1.20.7.linux-$TARGETARCH.tar.gz" | tar --strip-components=1 -xz -C /usr/local/go && \
RUN mkdir -p /usr/local/go && wget -qO- "https://go.dev/dl/go1.21.10.linux-$TARGETARCH.tar.gz" | tar --strip-components=1 -xz -C /usr/local/go && \
mkdir -p "$GOPATH/src" "$GOPATH/bin" && \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ${GOROOT}/bin v1.46.2 && \
# export GO111MODULE=on && go get github.com/quasilyte/go-ruleguard/cmd/[email protected] && \
Expand Down
2 changes: 1 addition & 1 deletion build/docker/meta-migration/builder/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
FROM golang:1.18.3-alpine3.16
FROM golang:1.21.10-alpine3.19
RUN apk add --no-cache make bash
Empty file added configs/pgo/default.pgo
Empty file.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/milvus-io/milvus

go 1.18
go 1.21

require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0
Expand Down
2 changes: 1 addition & 1 deletion pkg/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/milvus-io/milvus/pkg

go 1.18
go 1.21

require (
github.com/apache/pulsar-client-go v0.6.1-0.20210728062540-29414db801a7
Expand Down
2 changes: 1 addition & 1 deletion scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

```
OS: Ubuntu 20.04
go:1.18
go:1.21
cmake: >=3.18
gcc: 7.5
```
Expand Down

0 comments on commit abc7c84

Please sign in to comment.