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

upgrade go-genproto submodules to avoid ambiguous import errors #18

Merged
merged 9 commits into from
Aug 28, 2024
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
7 changes: 3 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.19]
go-version: [1.23]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
env:
Expand All @@ -30,9 +30,8 @@ jobs:
sudo apt-get install -y protobuf-compiler
make build
- name: Lint
uses: golangci/golangci-lint-action@v4
uses: golangci/golangci-lint-action@v6
with:
version: v1.54
skip-pkg-cache: true
version: latest
- name: Test
run: go test -v -race ./...
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @joskfg @rccrdpccl
* @joskfg @paupm
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19-buster AS build
FROM golang:1.23-bookworm AS build

RUN apt-get update \
&& apt-get install -y protobuf-compiler
Expand Down
8 changes: 8 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ services:
MIDDLEWARES_SOCKET: "passthrough:///unix:///tmp/hp"
READ_ADAPTER: "AMQP"
WRITE_ADAPTER: "ELASTIC"
depends_on:
rabbit-mq:
condition: service_healthy
hp-middleware-pass:
volumes:
- ./sockets:/tmp
Expand All @@ -40,6 +43,11 @@ services:
ports:
- 15672:15672
- 5672:5672
healthcheck:
test: [ "CMD", "rabbitmqctl", "status"]
interval: 5s
timeout: 20s
retries: 5
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.4.2
ports:
Expand Down
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ module github.com/softonic/homing-pigeon

require (
github.com/elastic/go-elasticsearch/v7 v7.10.0
github.com/golang/protobuf v1.5.2
github.com/golang/protobuf v1.5.4
github.com/streadway/amqp v1.0.0
github.com/stretchr/testify v1.7.0
google.golang.org/grpc v1.44.0
google.golang.org/protobuf v1.27.1
google.golang.org/grpc v1.66.0
google.golang.org/protobuf v1.34.2
k8s.io/klog v1.0.0
)

Expand All @@ -16,12 +16,12 @@ require (
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/objx v0.3.0 // indirect
golang.org/x/net v0.0.0-20220225143137-f80d34dcf065 // indirect
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
golang.org/x/text v0.3.8 // indirect
google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240730163845-b1a4ccb954bf // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)

go 1.19
go 1.23
149 changes: 16 additions & 133 deletions go.sum

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions pkg/main.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package main

import (
"os"
"strconv"

"github.com/softonic/homing-pigeon/pkg/messages"
"github.com/softonic/homing-pigeon/pkg/middleware"
"github.com/softonic/homing-pigeon/pkg/readers"
"github.com/softonic/homing-pigeon/pkg/writers"
"k8s.io/klog"
"os"
"strconv"
)

func main() {
Expand All @@ -18,15 +19,14 @@ func main() {
msgCh2 := make(chan messages.Message, bufLen)

bufLen = GetBufferLength("ACK_BUFFER_LENGTH")
ackCh1 := make(chan messages.Ack, bufLen)
ackCh2 := make(chan messages.Ack, bufLen)
ackCh := make(chan messages.Ack, bufLen)

reader, err := readers.NewReader(msgCh1, ackCh2)
reader, err := readers.NewReader(msgCh1, ackCh)
if err != nil {
panic(err)
}

writer, err := writers.NewWriter(msgCh2, ackCh1)
writer, err := writers.NewWriter(msgCh2, ackCh)
if err != nil {
panic(err)
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/middleware/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package middleware

import (
"context"
"time"

"github.com/softonic/homing-pigeon/pkg/helpers"
"github.com/softonic/homing-pigeon/pkg/messages"
"github.com/softonic/homing-pigeon/proto"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"k8s.io/klog"
"time"
)

// @TODO Tests missing
Expand All @@ -30,9 +31,8 @@ func (m *MiddlwareManager) Start() {

var opts []grpc.DialOption
opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials()))
opts = append(opts, grpc.WithBlock())

conn, err := grpc.Dial(m.MiddlewareAddress, opts...)
conn, err := grpc.NewClient(m.MiddlewareAddress, opts...)
if err != nil {
klog.Errorf("fail to dial: %v", err)
}
Expand Down
10 changes: 5 additions & 5 deletions pkg/middleware/unimplemented.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ package middleware

import (
"context"
"net"
"os"
"path/filepath"

. "github.com/softonic/homing-pigeon/pkg/helpers"
"github.com/softonic/homing-pigeon/proto"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"k8s.io/klog"
"net"
"os"
"path/filepath"
)

// @TODO Tests missing
Expand Down Expand Up @@ -70,9 +71,8 @@ func (b *UnimplementedMiddleware) getOutputGrpc() (*grpc.ClientConn, *proto.Midd
if nextSocketAddr != "" {
var opts []grpc.DialOption
opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials()))
opts = append(opts, grpc.WithBlock())

conn, err := grpc.Dial(nextSocketAddr, opts...)
conn, err := grpc.NewClient(nextSocketAddr, opts...)
if err != nil {
klog.Errorf("fail to dial: %v", err)
}
Expand Down
9 changes: 5 additions & 4 deletions pkg/readers/adapters/amqp.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import (
"bytes"
"crypto/tls"
"crypto/x509"
"html/template"
"os"
"strconv"
"strings"

"github.com/softonic/homing-pigeon/pkg/helpers"
"github.com/softonic/homing-pigeon/pkg/messages"
amqpAdapter "github.com/softonic/homing-pigeon/pkg/readers/adapters/amqp"
"github.com/streadway/amqp"
"html/template"
"k8s.io/klog"
"os"
"strconv"
"strings"
)

type Amqp struct {
Expand Down
Loading