Skip to content

Commit fbe79af

Browse files
Vipul Rawatdependabot[bot]Umang01-hash
authored
Release v1.2.1 (#409)
* Bump google.golang.org/api from 0.170.0 to 0.171.0 (#405) Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.170.0 to 0.171.0. - [Release notes](https://github.com/googleapis/google-api-go-client/releases) - [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md) - [Commits](googleapis/google-api-go-client@v0.170.0...v0.171.0) --- updated-dependencies: - dependency-name: google.golang.org/api dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * add Access Control Allow Headers to CORS middleware. (#407) * add Access Control Allow Headers to CORS middleware * fix failing tests * fix cors test --------- Co-authored-by: vipul-rawat-zs <[email protected]> * Remove double spaces from SQL logs and make error logs uniform (#404) * standardising log content * clean the sql and redis queries before logging queries * add clean function using regex to remove unnecessary spaces in sql query * standardize log messages * update gofr version - 1.2.1 --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Umang Mundhra <[email protected]>
1 parent 7a1e069 commit fbe79af

File tree

28 files changed

+103
-64
lines changed

28 files changed

+103
-64
lines changed

examples/using-migrations/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func GetHandler(c *gofr.Context) (interface{}, error) {
4949
err := c.SQL.QueryRowContext(c, queryGetEmployee, name).
5050
Scan(&emp.ID, &emp.Name, &emp.Gender, &emp.Phone, &emp.DOB)
5151
if err != nil {
52-
return nil, errors.New(fmt.Sprintf("DB Error : %v", err))
52+
return nil, errors.New(fmt.Sprintf("DB Error: %v", err))
5353
}
5454

5555
return emp, nil
@@ -66,8 +66,8 @@ func PostHandler(c *gofr.Context) (interface{}, error) {
6666
// Execute the INSERT query
6767
_, err := c.SQL.ExecContext(c, queryInsertEmployee, emp.ID, emp.Name, emp.Gender, emp.Phone, emp.DOB)
6868
if err != nil {
69-
return Employee{}, errors.New(fmt.Sprintf("DB Error : %v", err))
69+
return Employee{}, errors.New(fmt.Sprintf("DB Error: %v", err))
7070
}
7171

72-
return fmt.Sprintf("successfully posted entity : %v", emp.Name), nil
72+
return fmt.Sprintf("successfully posted entity: %v", emp.Name), nil
7373
}

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ require (
3333
go.uber.org/mock v0.4.0
3434
golang.org/x/oauth2 v0.18.0
3535
golang.org/x/term v0.18.0
36-
google.golang.org/api v0.170.0
36+
google.golang.org/api v0.171.0
3737
google.golang.org/grpc v1.62.1
3838
google.golang.org/protobuf v1.33.0
3939
)
@@ -57,7 +57,7 @@ require (
5757
github.com/google/go-cmp v0.6.0 // indirect
5858
github.com/google/s2a-go v0.1.7 // indirect
5959
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
60-
github.com/googleapis/gax-go/v2 v2.12.2 // indirect
60+
github.com/googleapis/gax-go/v2 v2.12.3 // indirect
6161
github.com/gorilla/websocket v1.5.0 // indirect
6262
github.com/klauspost/compress v1.16.6 // indirect
6363
github.com/openzipkin/zipkin-go v0.4.2 // indirect
@@ -81,7 +81,7 @@ require (
8181
golang.org/x/time v0.5.0 // indirect
8282
google.golang.org/appengine v1.6.8 // indirect
8383
google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect
84-
google.golang.org/genproto/googleapis/api v0.0.0-20240304161311-37d4d3c04a78 // indirect
85-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240311132316-a219d84964c2 // indirect
84+
google.golang.org/genproto/googleapis/api v0.0.0-20240311132316-a219d84964c2 // indirect
85+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240314234333-6e1732d8331c // indirect
8686
gopkg.in/yaml.v3 v3.0.1 // indirect
8787
)

go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
103103
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
104104
github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs=
105105
github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0=
106-
github.com/googleapis/gax-go/v2 v2.12.2 h1:mhN09QQW1jEWeMF74zGR81R30z4VJzjZsfkUhuHF+DA=
107-
github.com/googleapis/gax-go/v2 v2.12.2/go.mod h1:61M8vcyyXR2kqKFxKrfA22jaA8JGF7Dc8App1U3H6jc=
106+
github.com/googleapis/gax-go/v2 v2.12.3 h1:5/zPPDvw8Q1SuXjrqrZslrqT7dL/uJT2CQii/cLCKqA=
107+
github.com/googleapis/gax-go/v2 v2.12.3/go.mod h1:AKloxT6GtNbaLm8QTNSidHUVsHYcBHwWRvkNFJUQcS4=
108108
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
109109
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
110110
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
@@ -314,8 +314,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
314314
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
315315
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
316316
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
317-
google.golang.org/api v0.170.0 h1:zMaruDePM88zxZBG+NG8+reALO2rfLhe/JShitLyT48=
318-
google.golang.org/api v0.170.0/go.mod h1:/xql9M2btF85xac/VAm4PsLMTLVGUOpq4BE9R8jyNy8=
317+
google.golang.org/api v0.171.0 h1:w174hnBPqut76FzW5Qaupt7zY8Kql6fiVjgys4f58sU=
318+
google.golang.org/api v0.171.0/go.mod h1:Hnq5AHm4OTMt2BUVjael2CWZFD6vksJdWCWiUAmjC9o=
319319
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
320320
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
321321
google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM=
@@ -326,10 +326,10 @@ google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfG
326326
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
327327
google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 h1:9+tzLLstTlPTRyJTh+ah5wIMsBW5c4tQwGTN3thOW9Y=
328328
google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9/go.mod h1:mqHbVIp48Muh7Ywss/AD6I5kNVKZMmAa/QEW58Gxp2s=
329-
google.golang.org/genproto/googleapis/api v0.0.0-20240304161311-37d4d3c04a78 h1:SzXBGiWM1LNVYLCRP3e0/Gsze804l4jGoJ5lYysEO5I=
330-
google.golang.org/genproto/googleapis/api v0.0.0-20240304161311-37d4d3c04a78/go.mod h1:O1cOfN1Cy6QEYr7VxtjOyP5AdAuR0aJ/MYZaaof623Y=
331-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240311132316-a219d84964c2 h1:9IZDv+/GcI6u+a4jRFRLxQs0RUCfavGfoOgEW6jpkI0=
332-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240311132316-a219d84964c2/go.mod h1:UCOku4NytXMJuLQE5VuqA5lX3PcHCBo8pxNyvkf4xBs=
329+
google.golang.org/genproto/googleapis/api v0.0.0-20240311132316-a219d84964c2 h1:rIo7ocm2roD9DcFIX67Ym8icoGCKSARAiPljFhh5suQ=
330+
google.golang.org/genproto/googleapis/api v0.0.0-20240311132316-a219d84964c2/go.mod h1:O1cOfN1Cy6QEYr7VxtjOyP5AdAuR0aJ/MYZaaof623Y=
331+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240314234333-6e1732d8331c h1:lfpJ/2rWPa/kJgxyyXM8PrNnfCzcmxJ265mADgwmvLI=
332+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240314234333-6e1732d8331c/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY=
333333
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
334334
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
335335
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=

pkg/gofr/container/health_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
func TestContainer_Health(t *testing.T) {
2020
mockDB, mock, err := sqlmock.New()
2121
if err != nil {
22-
t.Fatalf("could not initialize mock database err : %v", err)
22+
t.Fatalf("could not initialize mock database err: %v", err)
2323
}
2424

2525
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {

pkg/gofr/datasource/pubsub/google/google.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ type googleClient struct {
3535
func New(conf Config, logger pubsub.Logger, metrics Metrics) *googleClient {
3636
err := validateConfigs(&conf)
3737
if err != nil {
38-
logger.Errorf("google pubsub could not be configured, err : %v", err)
38+
logger.Errorf("google pubsub could not be configured, err: %v", err)
3939

4040
return nil
4141
}
@@ -47,6 +47,8 @@ func New(conf Config, logger pubsub.Logger, metrics Metrics) *googleClient {
4747
}
4848
}
4949

50+
logger.Debugf("intialized google pubsub client, projectID: %s", client.Project())
51+
5052
return &googleClient{
5153
Config: conf,
5254
client: client,
@@ -158,7 +160,7 @@ func (g *googleClient) getSubscription(ctx context.Context, topic *gcPubSub.Topi
158160
// check if subscription already exists or not
159161
ok, err := subscription.Exists(context.Background())
160162
if err != nil {
161-
g.logger.Errorf("unable to check the existence of subscription, err : %v ", err.Error())
163+
g.logger.Errorf("unable to check the existence of subscription, err: %v ", err.Error())
162164

163165
return nil, err
164166
}

pkg/gofr/datasource/pubsub/kafka/health.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func (k *kafkaClient) getReaderStatsAsMap() []interface{} {
3030
for _, reader := range k.reader {
3131
var readerStat map[string]interface{}
3232
if err := convertStructToMap(reader.Stats(), &readerStat); err != nil {
33-
k.logger.Errorf("Kafka Reader Stats processing failed: %v", err)
33+
k.logger.Errorf("kafka Reader Stats processing failed: %v", err)
3434
continue // Log the error but continue processing other readers
3535
}
3636

@@ -44,7 +44,7 @@ func (k *kafkaClient) getWriterStatsAsMap() map[string]interface{} {
4444
writerStats := make(map[string]interface{})
4545

4646
if err := convertStructToMap(k.writer.Stats(), &writerStats); err != nil {
47-
k.logger.Errorf("Kafka Writer Stats processing failed: %v", err)
47+
k.logger.Errorf("kafka Writer Stats processing failed: %v", err)
4848

4949
return nil
5050
}

pkg/gofr/datasource/pubsub/kafka/kafka.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ type kafkaClient struct {
4343
func New(conf Config, logger pubsub.Logger, metrics Metrics) *kafkaClient {
4444
err := validateConfigs(conf)
4545
if err != nil {
46-
logger.Errorf("could not initialize kafka, err : %v", err)
46+
logger.Errorf("could not initialize kafka, err: %v", err)
4747

4848
return nil
4949
}
5050

5151
conn, err := kafka.Dial("tcp", conf.Broker)
5252
if err != nil {
53-
logger.Errorf("Failed to connect to KAFKA at %v", conf.Broker)
53+
logger.Errorf("failed to connect to KAFKA at %v", conf.Broker)
5454
}
5555

5656
dialer := &kafka.Dialer{
@@ -65,6 +65,8 @@ func New(conf Config, logger pubsub.Logger, metrics Metrics) *kafkaClient {
6565

6666
reader := make(map[string]Reader)
6767

68+
logger.Debugf("connected to Kafka, broker: %s", conf.Broker)
69+
6870
return &kafkaClient{
6971
config: conf,
7072
dialer: dialer,

pkg/gofr/datasource/pubsub/mqtt/mqtt.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func getDefaultClient(config *Config, logger Logger, metrics Metrics) *MQTT {
9999

100100
msg := make(map[string]chan *pubsub.Message)
101101

102-
logger.Debugf("connected to MQTT, HostName : %v, Port : %v", config.Hostname, config.Port)
102+
logger.Debugf("connected to MQTT, HostName: %v, Port: %v", config.Hostname, config.Port)
103103
logger.Debugf("using %v clientID for this MQTT session", clientID)
104104

105105
return &MQTT{Client: client, config: config, logger: logger, msgChanMap: msg, mu: new(sync.RWMutex), metrics: metrics}
@@ -194,7 +194,7 @@ func (m *MQTT) Publish(ctx context.Context, topic string, message []byte) error
194194
// Check for errors during publishing (More on error reporting
195195
// https://pkg.go.dev/github.com/eclipse/paho.mqtt.golang#readme-error-handling)
196196
if token.Wait() && token.Error() != nil {
197-
m.logger.Errorf("error while publishing message, err : %v", token.Error())
197+
m.logger.Errorf("error while publishing message, err %v", token.Error())
198198

199199
return token.Error()
200200
}
@@ -238,7 +238,7 @@ func (m *MQTT) CreateTopic(_ context.Context, topic string) error {
238238
token.Wait()
239239

240240
if token.Error() != nil {
241-
m.logger.Errorf("unable to create topic - %s, error : %v", topic, token.Error())
241+
m.logger.Errorf("unable to create topic - %s, error: %v", topic, token.Error())
242242

243243
return token.Error()
244244
}
@@ -288,7 +288,7 @@ func (m *MQTT) Unsubscribe(topic string) error {
288288
token.Wait()
289289

290290
if token.Error() != nil {
291-
m.logger.Errorf("error while unsubscribing from topic %s, err : %v", topic, token.Error())
291+
m.logger.Errorf("error while unsubscribing from topic %s, err: %v", topic, token.Error())
292292

293293
return token.Error()
294294
}

pkg/gofr/datasource/pubsub/mqtt/mqtt_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func TestMQTT_EmptyConfigs(t *testing.T) {
5050

5151
assert.NotNil(t, client)
5252
assert.Contains(t, out, "connected to MQTT")
53-
assert.Contains(t, out, "Port : 1883")
53+
assert.Contains(t, out, "Port: 1883")
5454
}
5555

5656
func TestMQTT_getMQTTClientOptions(t *testing.T) {

pkg/gofr/datasource/redis/redis.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func NewClient(c config.Config, logger datasource.Logger, metrics Metrics) *Redi
6767
}
6868

6969
if err := otel.InstrumentTracing(rc); err != nil {
70-
logger.Errorf("could not add tracing instrumentation, error : %s", err)
70+
logger.Errorf("could not add tracing instrumentation, error: %s", err)
7171
}
7272

7373
logger.Logf("connected to redis at %s:%d", redisConfig.HostName, redisConfig.Port)

0 commit comments

Comments
 (0)