Skip to content
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

Add ferretdb_ prefix to our custom build tags #869

Merged
merged 2 commits into from
Jul 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ ENV CGO_ENABLED=1

# split into several commands for better logging on GitHub Actions
RUN go mod download
RUN go build -v -o=bin/ferretdb -trimpath -tags=testcover,tigris -race ./cmd/ferretdb
RUN go test -c -o=bin/ferretdb -trimpath -tags=testcover,tigris -race -coverpkg=./... ./cmd/ferretdb
RUN go build -v -o=bin/ferretdb -trimpath -tags=ferretdb_testcover,ferretdb_tigris -race ./cmd/ferretdb
RUN go test -c -o=bin/ferretdb -trimpath -tags=ferretdb_testcover,ferretdb_tigris -race -coverpkg=./... ./cmd/ferretdb

FROM golang:1.18.3

Expand Down
6 changes: 3 additions & 3 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ tasks:
cmds:
- go test -count=1 {{if ne OS "windows"}}-race{{end}} -run=TestEnvData . -port=37017
- go test -count=1 {{if ne OS "windows"}}-race{{end}} -run=TestEnvData . -handler=pg
- go test -count=1 {{if ne OS "windows"}}-race{{end}} -run=TestEnvData -tags=tigris ./tigris -handler=tigris
- go test -count=1 {{if ne OS "windows"}}-race{{end}} -run=TestEnvData -tags=ferretdb_tigris ./tigris -handler=tigris

gen:
desc: "Generate (and format) code"
Expand Down Expand Up @@ -130,7 +130,7 @@ tasks:
desc: "Run integration tests for Tigris handler"
dir: integration/tigris
cmds:
- go test -count=1 {{if ne OS "windows"}}-race{{end}} -tags=tigris -shuffle=on -coverprofile=integration-tigris.txt -coverpkg=../... -handler=tigris
- go test -count=1 {{if ne OS "windows"}}-race{{end}} -tags=ferretdb_tigris -shuffle=on -coverprofile=integration-tigris.txt -coverpkg=../... -handler=tigris

test-integration-mongodb:
desc: "Run integration tests for MongoDB"
Expand Down Expand Up @@ -183,7 +183,7 @@ tasks:
desc: "Build bin/ferretdb-testcover"
deps: [gen-version]
cmds:
- go test -c -o=bin/ferretdb-testcover{{exeExt}} -trimpath -tags=testcover,tigris {{if ne OS "windows"}}-race{{end}} -coverpkg=./... ./cmd/ferretdb
- go test -c -o=bin/ferretdb-testcover{{exeExt}} -trimpath -tags=ferretdb_testcover,ferretdb_tigris {{if ne OS "windows"}}-race{{end}} -coverpkg=./... ./cmd/ferretdb

run:
desc: "Run FerretDB"
Expand Down
2 changes: 1 addition & 1 deletion cmd/ferretdb/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build testcover
//go:build ferretdb_testcover

package main

Expand Down
4 changes: 2 additions & 2 deletions cmd/ferretdb/main_tigris.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build tigris
//go:build ferretdb_tigris

package main

import (
"flag"
)

// init adds `tigris` handler flags when `tigris` build tag is provided.
// init adds "tigris" handler flags when "ferretdb_tigris" build tag is provided.
func init() {
flag.StringVar(&tigrisURL, "tigris-url", "127.0.0.1:8081", "Tigris URL")
}
4 changes: 2 additions & 2 deletions internal/handlers/registry/tigris.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build tigris
//go:build ferretdb_tigris

package registry

Expand All @@ -21,7 +21,7 @@ import (
"github.com/FerretDB/FerretDB/internal/handlers/tigris"
)

// init registers `tigris` handler for Tigris when `tigris` build tag is provided.
// init registers "tigris" handler for Tigris when "ferretdb_tigris" build tag is provided.
func init() {
registry["tigris"] = func(opts *NewHandlerOpts) (handlers.Interface, error) {
handlerOpts := &tigris.NewOpts{
Expand Down
4 changes: 2 additions & 2 deletions internal/util/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type Info struct {
Commit string
Branch string
Dirty bool
Debug bool // testcover or -race
Debug bool // -tags=ferretdb_testcover or -race
BuildEnvironment *types.Document
}

Expand Down Expand Up @@ -124,7 +124,7 @@ func init() {
info.Debug = true
}
case "-tags":
if slices.Contains(strings.Split(s.Value, ","), "testcover") {
if slices.Contains(strings.Split(s.Value, ","), "ferretdb_testcover") {
info.Debug = true
}
}
Expand Down