diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bdaa84a..4d1c13b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,27 +1,52 @@ +variables: + GIT_BRANCH: "${CI_COMMIT_REF_SLUG}" + GIT_SUBMODULE_STRATEGY: recursive + stages: - - lint - - test + - sync-from-github + - sync-to-github -lint: - image: golangci/golangci-lint:v1.42.1 - stage: lint +sync_from_github_job: + stage: sync-from-github + before_script: + - apk add --no-cache git openssh-client + - mkdir -p ~/.ssh + - echo "${SSH_PRIVATE_KEY}" | tr -d '\r' > ~/.ssh/id_rsa + - chmod 600 ~/.ssh/id_rsa + - ssh-keyscan gitlab.snapp.ir >> ~/.ssh/known_hosts + - ssh-keyscan github.com >> ~/.ssh/known_hosts script: - - golangci-lint run ./... + - echo "Starting sync-from-github job" + - git config --global user.email "platform@snapp.cab" + - git config --global user.name "Platform" + - git clone git@github.com:snapp-incubator/smapp-sdk-go.git + - cd smapp-sdk-go + - git remote add gitlab git@gitlab.snapp.ir:Map/sdk/smapp-sdk-go.git + - git fetch origin main + - git fetch gitlab $GIT_BRANCH + - git merge gitlab/$GIT_BRANCH + - git push gitlab HEAD:$GIT_BRANCH only: - refs: - - master - allow_failure: false + - schedules -test: - image: golang:1.17 +sync_to_github_job: + stage: sync-to-github + before_script: + - apk add --no-cache git openssh-client + - mkdir -p ~/.ssh + - echo "${SSH_PRIVATE_KEY}" | tr -d '\r' > ~/.ssh/id_rsa + - chmod 600 ~/.ssh/id_rsa + - ssh-keyscan gitlab.snapp.ir >> ~/.ssh/known_hosts + - ssh-keyscan github.com >> ~/.ssh/known_hosts script: - - export GOPROXY=https://repo.snapp.tech/repository/goproxy/ - - export GO111MODULE=on - - go mod download - - go test -race $(go list ./... | grep -v /vendor/) -v -coverprofile=coverage.out && grep -v "mock.go" coverage.out > cover.out - - go tool cover -func=cover.out - - only: - refs: - - pushes - allow_failure: false + - echo "Starting sync-to-github job" + - git config --global user.email "platform@snapp.cab" + - git config --global user.name "Platform" + - git clone git@github.com:snapp-incubator/smapp-sdk-go.git + - cd smapp-sdk-go + - git remote add gitlab git@gitlab.snapp.ir:Map/sdk/smapp-sdk-go.git + - git fetch origin main + - git fetch gitlab $GIT_BRANCH + - git merge gitlab/$GIT_BRANCH + - git push origin HEAD:main + when: manual diff --git a/go.mod b/go.mod index c395bc8..ba81cdb 100644 --- a/go.mod +++ b/go.mod @@ -1,16 +1,17 @@ module github.com/snapp-incubator/smapp-sdk-go -go 1.17 +go 1.22 require ( github.com/golang/mock v1.6.0 - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.27.0 - go.opentelemetry.io/otel v1.2.0 - go.opentelemetry.io/otel/trace v1.2.0 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 + go.opentelemetry.io/otel v1.29.0 + go.opentelemetry.io/otel/trace v1.29.0 ) require ( - github.com/felixge/httpsnoop v1.0.2 // indirect - go.opentelemetry.io/otel/internal/metric v0.25.0 // indirect - go.opentelemetry.io/otel/metric v0.25.0 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect + github.com/go-logr/logr v1.4.2 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + go.opentelemetry.io/otel/metric v1.29.0 // indirect ) diff --git a/go.sum b/go.sum index e2df352..dc025ca 100644 --- a/go.sum +++ b/go.sum @@ -1,27 +1,29 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o= -github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.27.0 h1:0BgiNWjN7rUWO9HdjF4L12r8OW86QkVQcYmCjnayJLo= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.27.0/go.mod h1:bdvm3YpMxWAgEfQhtTBaVR8ceXPRuRBSQrvOBnIlHxc= -go.opentelemetry.io/otel v1.2.0 h1:YOQDvxO1FayUcT9MIhJhgMyNO1WqoduiyvQHzGN0kUQ= -go.opentelemetry.io/otel v1.2.0/go.mod h1:aT17Fk0Z1Nor9e0uisf98LrntPGMnk4frBO9+dkf69I= -go.opentelemetry.io/otel/internal/metric v0.25.0 h1:w/7RXe16WdPylaIXDgcYM6t/q0K5lXgSdZOEbIEyliE= -go.opentelemetry.io/otel/internal/metric v0.25.0/go.mod h1:Nhuw26QSX7d6n4duoqAFi5KOQR4AuzyMcl5eXOgwxtc= -go.opentelemetry.io/otel/metric v0.25.0 h1:7cXOnCADUsR3+EOqxPaSKwhEuNu0gz/56dRN1hpIdKw= -go.opentelemetry.io/otel/metric v0.25.0/go.mod h1:E884FSpQfnJOMMUaq+05IWlJ4rjZpk2s/F1Ju+TEEm8= -go.opentelemetry.io/otel/trace v1.2.0 h1:Ys3iqbqZhcf28hHzrm5WAquMkDHNZTUkw7KHbuNjej0= -go.opentelemetry.io/otel/trace v1.2.0/go.mod h1:N5FLswTubnxKxOJHM7XZC074qpeEdLy3CgAVsdMucK0= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 h1:TT4fX+nBOA/+LUkobKGW1ydGcn+G3vRw9+g5HwCphpk= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0/go.mod h1:L7UH0GbB0p47T4Rri3uHjbpCFYrVrwc1I25QhNPiGK8= +go.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw= +go.opentelemetry.io/otel v1.29.0/go.mod h1:N/WtXPs1CNCUEx+Agz5uouwCba+i+bJGFicT8SR4NP8= +go.opentelemetry.io/otel/metric v1.29.0 h1:vPf/HFWTNkPu1aYeIsc98l4ktOQaL6LeSoeV2g+8YLc= +go.opentelemetry.io/otel/metric v1.29.0/go.mod h1:auu/QWieFVWx+DmQOUMgj0F8LHWdgalxXqvp7BII/W8= +go.opentelemetry.io/otel/trace v1.29.0 h1:J/8ZNK4XgR7a21DZUAsbF8pZ5Jcw1VhACmnYt39JTi4= +go.opentelemetry.io/otel/trace v1.29.0/go.mod h1:eHl3w0sp3paPkYstJOmAimxhiFXPg+MMTlEh3nsQgWQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -43,8 +45,6 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/services/reverse/reverse_mock.go b/services/reverse/reverse_mock.go index cf72e61..17e9dd1 100644 --- a/services/reverse/reverse_mock.go +++ b/services/reverse/reverse_mock.go @@ -1,7 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: services/reverse/reverse.go - -// Package reverse is a generated GoMock package. package reverse import ( @@ -34,6 +32,66 @@ func (m *MockReverseClient) EXPECT() *MockReverseClientMockRecorder { return m.recorder } +// GetBatch mocks base method. +func (m *MockReverseClient) GetBatch(request BatchReverseRequest) ([]Result, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetBatch", request) + ret0, _ := ret[0].([]Result) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetBatch indicates an expected call of GetBatch. +func (mr *MockReverseClientMockRecorder) GetBatch(request interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBatch", reflect.TypeOf((*MockReverseClient)(nil).GetBatch), request) +} + +// GetBatchDisplayName mocks base method. +func (m *MockReverseClient) GetBatchDisplayName(request BatchReverseRequest) ([]ResultWithDisplayName, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetBatchDisplayName", request) + ret0, _ := ret[0].([]ResultWithDisplayName) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetBatchDisplayName indicates an expected call of GetBatchDisplayName. +func (mr *MockReverseClientMockRecorder) GetBatchDisplayName(request interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBatchDisplayName", reflect.TypeOf((*MockReverseClient)(nil).GetBatchDisplayName), request) +} + +// GetBatchDisplayNameWithContext mocks base method. +func (m *MockReverseClient) GetBatchDisplayNameWithContext(ctx context.Context, request BatchReverseRequest) ([]ResultWithDisplayName, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetBatchDisplayNameWithContext", ctx, request) + ret0, _ := ret[0].([]ResultWithDisplayName) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetBatchDisplayNameWithContext indicates an expected call of GetBatchDisplayNameWithContext. +func (mr *MockReverseClientMockRecorder) GetBatchDisplayNameWithContext(ctx, request interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBatchDisplayNameWithContext", reflect.TypeOf((*MockReverseClient)(nil).GetBatchDisplayNameWithContext), ctx, request) +} + +// GetBatchWithContext mocks base method. +func (m *MockReverseClient) GetBatchWithContext(ctx context.Context, request BatchReverseRequest) ([]Result, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetBatchWithContext", ctx, request) + ret0, _ := ret[0].([]Result) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetBatchWithContext indicates an expected call of GetBatchWithContext. +func (mr *MockReverseClientMockRecorder) GetBatchWithContext(ctx, request interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBatchWithContext", reflect.TypeOf((*MockReverseClient)(nil).GetBatchWithContext), ctx, request) +} + // GetComponents mocks base method. func (m *MockReverseClient) GetComponents(lat, lon float64, options CallOptions) ([]Component, error) { m.ctrl.T.Helper() diff --git a/version/version.go b/version/version.go index 30eb208..fd26369 100644 --- a/version/version.go +++ b/version/version.go @@ -3,7 +3,7 @@ package version import "fmt" const ( - Version = "v0.9.11" + Version = "v0.9.12" UserAgentHeader = "User-Agent" )