From 16490f7d0000034ea8a479e3b0f463ac446e47fe Mon Sep 17 00:00:00 2001 From: Link Dupont Date: Mon, 12 Aug 2024 10:38:06 -0400 Subject: [PATCH] refactor!: add "v1" to module Rename the module to include a v1 suffix. Since the API of the yggdrasil-0.2 branch is frozen, adding an API suffix shouldn't be harmful, but would require clients to update their import paths when updating to newer versions of the yggdrasil-0.2 project. --- HACKING.md | 6 +++--- Makefile | 34 +++++++++++++++++----------------- README.md | 2 +- cmd/ygg/activate.go | 2 +- cmd/ygg/main.go | 4 ++-- cmd/yggd/grpc.go | 4 ++-- cmd/yggd/http.go | 2 +- cmd/yggd/main.go | 6 +++--- cmd/yggd/mqtt.go | 2 +- cmd/yggd/worker.go | 2 +- go.mod | 4 ++-- protocol/yggdrasil.proto | 2 +- worker/echo/main.go | 2 +- worker/echo/server.go | 2 +- 14 files changed, 37 insertions(+), 37 deletions(-) diff --git a/HACKING.md b/HACKING.md index 9f8ffae3..37ac0b12 100644 --- a/HACKING.md +++ b/HACKING.md @@ -79,11 +79,11 @@ github.com/ofabry/go-callvis`) and run: # Call graph of the main function of yggd, up to calls into the yggdrasil package go-callvis -nostd -format png -file yggdrasil.main ./cmd/yggd # Call graph of the yggdrasil package, as invoked by yggd -go-callvis -nostd -format png -file yggdrasil.yggdrasil -focus github.com/redhatinsights/yggdrasil ./cmd/yggd +go-callvis -nostd -format png -file yggdrasil.yggdrasil -focus github.com/redhatinsights/yggdrasil/v1 ./cmd/yggd # Call graph of the main function of ygg, up to calls into the yggdrasil package go-callvis -nostd -format png -file ygg.main ./cmd/ygg # Call graph of the yggdrasil package, as invoked by ygg -go-callvis -nostd -format png -file ygg.yggdrasil -focus github.com/redhatinsights/yggdrasil ./cmd/ygg +go-callvis -nostd -format png -file ygg.yggdrasil -focus github.com/redhatinsights/yggdrasil/v1./cmd/ygg ``` For more detailed, interactive call graphs, install `callgraph` and `digraph`. @@ -98,7 +98,7 @@ standard library calls and pipe the result into `digraph`. See the `-help` output of `digraph` for how to interact with the graph. ```bash -callgraph -algo pta -format digraph ./cmd/ygg | grep github.com/redhatinsights/yggdrasil | sort | uniq | digraph +callgraph -algo pta -format digraph ./cmd/ygg | grep github.com/redhatinsights/yggdrasil/v1 | sort | uniq | digraph ``` # Code Guidelines diff --git a/Makefile b/Makefile index afadaa61..088db84a 100644 --- a/Makefile +++ b/Makefile @@ -43,23 +43,23 @@ SYSTEMD_SYSTEM_UNIT_DIR := $(shell pkg-config --variable systemdsystemunitdir s # Build flags LDFLAGS := -LDFLAGS += -X 'github.com/redhatinsights/yggdrasil.Version=$(VERSION)' -LDFLAGS += -X 'github.com/redhatinsights/yggdrasil.ShortName=$(SHORTNAME)' -LDFLAGS += -X 'github.com/redhatinsights/yggdrasil.LongName=$(LONGNAME)' -LDFLAGS += -X 'github.com/redhatinsights/yggdrasil.BrandName=$(BRANDNAME)' -LDFLAGS += -X 'github.com/redhatinsights/yggdrasil.PrefixDir=$(PREFIX)' -LDFLAGS += -X 'github.com/redhatinsights/yggdrasil.BinDir=$(BINDIR)' -LDFLAGS += -X 'github.com/redhatinsights/yggdrasil.SbinDir=$(SBINDIR)' -LDFLAGS += -X 'github.com/redhatinsights/yggdrasil.LibexecDir=$(LIBEXECDIR)' -LDFLAGS += -X 'github.com/redhatinsights/yggdrasil.SysconfDir=$(SYSCONFDIR)' -LDFLAGS += -X 'github.com/redhatinsights/yggdrasil.DataDir=$(DATADIR)' -LDFLAGS += -X 'github.com/redhatinsights/yggdrasil.DatarootDir=$(DATAROOTDIR)' -LDFLAGS += -X 'github.com/redhatinsights/yggdrasil.ManDir=$(MANDIR)' -LDFLAGS += -X 'github.com/redhatinsights/yggdrasil.DocDir=$(DOCDIR)' -LDFLAGS += -X 'github.com/redhatinsights/yggdrasil.LocalstateDir=$(LOCALSTATEDIR)' -LDFLAGS += -X 'github.com/redhatinsights/yggdrasil.TopicPrefix=$(TOPICPREFIX)' -LDFLAGS += -X 'github.com/redhatinsights/yggdrasil.DataHost=$(DATAHOST)' -LDFLAGS += -X 'github.com/redhatinsights/yggdrasil.Provider=$(PROVIDER)' +LDFLAGS += -X 'github.com/redhatinsights/yggdrasil/v1.Version=$(VERSION)' +LDFLAGS += -X 'github.com/redhatinsights/yggdrasil/v1.ShortName=$(SHORTNAME)' +LDFLAGS += -X 'github.com/redhatinsights/yggdrasil/v1.LongName=$(LONGNAME)' +LDFLAGS += -X 'github.com/redhatinsights/yggdrasil/v1.BrandName=$(BRANDNAME)' +LDFLAGS += -X 'github.com/redhatinsights/yggdrasil/v1.PrefixDir=$(PREFIX)' +LDFLAGS += -X 'github.com/redhatinsights/yggdrasil/v1.BinDir=$(BINDIR)' +LDFLAGS += -X 'github.com/redhatinsights/yggdrasil/v1.SbinDir=$(SBINDIR)' +LDFLAGS += -X 'github.com/redhatinsights/yggdrasil/v1.LibexecDir=$(LIBEXECDIR)' +LDFLAGS += -X 'github.com/redhatinsights/yggdrasil/v1.SysconfDir=$(SYSCONFDIR)' +LDFLAGS += -X 'github.com/redhatinsights/yggdrasil/v1.DataDir=$(DATADIR)' +LDFLAGS += -X 'github.com/redhatinsights/yggdrasil/v1.DatarootDir=$(DATAROOTDIR)' +LDFLAGS += -X 'github.com/redhatinsights/yggdrasil/v1.ManDir=$(MANDIR)' +LDFLAGS += -X 'github.com/redhatinsights/yggdrasil/v1.DocDir=$(DOCDIR)' +LDFLAGS += -X 'github.com/redhatinsights/yggdrasil/v1.LocalstateDir=$(LOCALSTATEDIR)' +LDFLAGS += -X 'github.com/redhatinsights/yggdrasil/v1.TopicPrefix=$(TOPICPREFIX)' +LDFLAGS += -X 'github.com/redhatinsights/yggdrasil/v1.DataHost=$(DATAHOST)' +LDFLAGS += -X 'github.com/redhatinsights/yggdrasil/v1.Provider=$(PROVIDER)' BUILDFLAGS ?= ifeq ($(shell find . -name vendor), ./vendor) diff --git a/README.md b/README.md index 733d214e..e629175b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![godocs.io](https://godocs.io/github.com/RedHatInsights/yggdrasil?status.svg)](https://godocs.io/github.com/RedHatInsights/yggdrasil) +[![godocs.io](https://godocs.io/github.com/RedHatInsights/yggdrasil/v1?status.svg)](https://godocs.io/github.com/RedHatInsights/yggdrasil/v1) # yggdrasil diff --git a/cmd/ygg/activate.go b/cmd/ygg/activate.go index b2173b1e..ce4efd0f 100644 --- a/cmd/ygg/activate.go +++ b/cmd/ygg/activate.go @@ -4,7 +4,7 @@ import ( "fmt" systemd "github.com/coreos/go-systemd/v22/dbus" - "github.com/redhatinsights/yggdrasil" + "github.com/redhatinsights/yggdrasil/v1" ) func activate() error { diff --git a/cmd/ygg/main.go b/cmd/ygg/main.go index f77790b2..cee17b9f 100644 --- a/cmd/ygg/main.go +++ b/cmd/ygg/main.go @@ -14,8 +14,8 @@ import ( "github.com/briandowns/spinner" systemd "github.com/coreos/go-systemd/v22/dbus" - "github.com/redhatinsights/yggdrasil" - internal "github.com/redhatinsights/yggdrasil/internal" + "github.com/redhatinsights/yggdrasil/v1" + internal "github.com/redhatinsights/yggdrasil/v1/internal" "github.com/urfave/cli/v2" "golang.org/x/term" ) diff --git a/cmd/yggd/grpc.go b/cmd/yggd/grpc.go index 731af120..b3c16661 100644 --- a/cmd/yggd/grpc.go +++ b/cmd/yggd/grpc.go @@ -9,8 +9,8 @@ import ( "time" "git.sr.ht/~spc/go-log" - "github.com/redhatinsights/yggdrasil" - pb "github.com/redhatinsights/yggdrasil/protocol" + "github.com/redhatinsights/yggdrasil/v1" + pb "github.com/redhatinsights/yggdrasil/v1/protocol" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" ) diff --git a/cmd/yggd/http.go b/cmd/yggd/http.go index 46fd44b0..eeb07694 100644 --- a/cmd/yggd/http.go +++ b/cmd/yggd/http.go @@ -9,7 +9,7 @@ import ( "strings" "git.sr.ht/~spc/go-log" - "github.com/redhatinsights/yggdrasil" + "github.com/redhatinsights/yggdrasil/v1" ) var ( diff --git a/cmd/yggd/main.go b/cmd/yggd/main.go index 8ecbbf92..4bf84160 100644 --- a/cmd/yggd/main.go +++ b/cmd/yggd/main.go @@ -15,9 +15,9 @@ import ( "git.sr.ht/~spc/go-log" mqtt "github.com/eclipse/paho.mqtt.golang" "github.com/google/uuid" - "github.com/redhatinsights/yggdrasil" - internal "github.com/redhatinsights/yggdrasil/internal" - pb "github.com/redhatinsights/yggdrasil/protocol" + "github.com/redhatinsights/yggdrasil/v1" + internal "github.com/redhatinsights/yggdrasil/v1/internal" + pb "github.com/redhatinsights/yggdrasil/v1/protocol" "github.com/rjeczalik/notify" "github.com/urfave/cli/v2" "github.com/urfave/cli/v2/altsrc" diff --git a/cmd/yggd/mqtt.go b/cmd/yggd/mqtt.go index 3b0153b3..af24f67d 100644 --- a/cmd/yggd/mqtt.go +++ b/cmd/yggd/mqtt.go @@ -11,7 +11,7 @@ import ( "git.sr.ht/~spc/go-log" mqtt "github.com/eclipse/paho.mqtt.golang" "github.com/google/uuid" - "github.com/redhatinsights/yggdrasil" + "github.com/redhatinsights/yggdrasil/v1" ) func handleDataMessage(client mqtt.Client, msg mqtt.Message, sendQ chan<- yggdrasil.Data) { diff --git a/cmd/yggd/worker.go b/cmd/yggd/worker.go index e870eceb..17d36a09 100644 --- a/cmd/yggd/worker.go +++ b/cmd/yggd/worker.go @@ -12,7 +12,7 @@ import ( "git.sr.ht/~spc/go-log" "github.com/pelletier/go-toml" - "github.com/redhatinsights/yggdrasil" + "github.com/redhatinsights/yggdrasil/v1" "github.com/rjeczalik/notify" "golang.org/x/net/http/httpproxy" ) diff --git a/go.mod b/go.mod index 87097372..7d4757fe 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/redhatinsights/yggdrasil +module github.com/redhatinsights/yggdrasil/v1 go 1.19 @@ -13,6 +13,7 @@ require ( github.com/pelletier/go-toml v1.9.3 github.com/rjeczalik/notify v0.9.2 github.com/urfave/cli/v2 v2.3.0 + golang.org/x/net v0.12.0 golang.org/x/term v0.13.0 google.golang.org/grpc v1.58.3 google.golang.org/protobuf v1.31.0 @@ -28,7 +29,6 @@ require ( github.com/mattn/go-isatty v0.0.8 // indirect github.com/russross/blackfriday/v2 v2.0.1 // indirect github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect - golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.11.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect diff --git a/protocol/yggdrasil.proto b/protocol/yggdrasil.proto index f757567a..57f4ce99 100644 --- a/protocol/yggdrasil.proto +++ b/protocol/yggdrasil.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -option go_package = "github.com/redhatinsights/yggdrasil/protocol"; +option go_package = "github.com/redhatinsights/yggdrasil/v1/protocol"; package yggdrasil; diff --git a/worker/echo/main.go b/worker/echo/main.go index 68f0e24d..f7768763 100644 --- a/worker/echo/main.go +++ b/worker/echo/main.go @@ -8,7 +8,7 @@ import ( "git.sr.ht/~spc/go-log" - pb "github.com/redhatinsights/yggdrasil/protocol" + pb "github.com/redhatinsights/yggdrasil/v1/protocol" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" ) diff --git a/worker/echo/server.go b/worker/echo/server.go index 76411133..d2aec329 100644 --- a/worker/echo/server.go +++ b/worker/echo/server.go @@ -6,7 +6,7 @@ import ( "git.sr.ht/~spc/go-log" "github.com/google/uuid" - pb "github.com/redhatinsights/yggdrasil/protocol" + pb "github.com/redhatinsights/yggdrasil/v1/protocol" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" )