Skip to content

Commit 8d75d15

Browse files
authored
Update golanglint-ci version and fix deprecated rand functions (#1109)
1 parent 3851e14 commit 8d75d15

File tree

5 files changed

+9
-41
lines changed

5 files changed

+9
-41
lines changed

build/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ ENTRYPOINT ["/go/bin/mixer"]
8282
FROM base as test
8383
WORKDIR /mixer
8484
# Golint
85-
RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.49.0
86-
RUN ./bin/golangci-lint run --timeout=600s
85+
RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.52.2
86+
RUN ./bin/golangci-lint run --timeout=600s --skip-dirs='internal/proto'
8787
# Test
8888
COPY test/ test
8989
COPY deploy/ deploy

build/ci/cloudbuild.test.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2019 Google LLC
1+
# Copyright 2023 Google LLC
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -26,8 +26,8 @@ steps:
2626
echo "bigquery.version should not have end of file newline"
2727
exit 1
2828
fi
29-
wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.49.0
30-
./bin/golangci-lint run --timeout=600s
29+
wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.52.2
30+
./bin/golangci-lint run --timeout=600s --skip-dirs='internal/proto'
3131
3232
- id: build-proto
3333
name: gcr.io/datcom-ci/go-protoc

internal/server/statvar/golden/search_statvar/poor.json

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3292,66 +3292,34 @@
32923292
}
32933293
]
32943294
},
3295-
{
3296-
"dcid": "dc/g/SDG_1.3.1",
3297-
"name": "1.3.1: Proportion of population covered by social protection floors/systems, by sex, distinguishing children, unemployed persons, older persons, persons with disabilities, pregnant women, newborns, work-injury victims and the poor and the vulnerable"
3298-
},
32993295
{
33003296
"dcid": "sdg/g/SDG_1.3.1",
33013297
"name": "1.3.1: Proportion of population covered by social protection floors/systems, by sex, distinguishing children, unemployed persons, older persons, persons with disabilities, pregnant women, newborns, work-injury victims and the poor and the vulnerable"
33023298
},
3303-
{
3304-
"dcid": "dc/g/SDG_1.3",
3305-
"name": "1.3: Implement nationally appropriate social protection systems and measures for all, including floors, and by 2030 achieve substantial coverage of the poor and the vulnerable"
3306-
},
33073299
{
33083300
"dcid": "sdg/g/SDG_1.3",
33093301
"name": "1.3: Implement nationally appropriate social protection systems and measures for all, including floors, and by 2030 achieve substantial coverage of the poor and the vulnerable"
33103302
},
3311-
{
3312-
"dcid": "dc/g/SDG_1.4",
3313-
"name": "1.4: By 2030, ensure that all men and women, in particular the poor and the vulnerable, have equal rights to economic resources, as well as access to basic services, ownership and control over land and other forms of property, inheritance, natural resources, appropriate new technology and financial services, including microfinance"
3314-
},
33153303
{
33163304
"dcid": "sdg/g/SDG_1.4",
33173305
"name": "1.4: By 2030, ensure that all men and women, in particular the poor and the vulnerable, have equal rights to economic resources, as well as access to basic services, ownership and control over land and other forms of property, inheritance, natural resources, appropriate new technology and financial services, including microfinance"
33183306
},
3319-
{
3320-
"dcid": "dc/g/SDG_1.5",
3321-
"name": "1.5: By 2030, build the resilience of the poor and those in vulnerable situations and reduce their exposure and vulnerability to climate-related extreme events and other economic, social and environmental shocks and disasters"
3322-
},
33233307
{
33243308
"dcid": "sdg/g/SDG_1.5",
33253309
"name": "1.5: By 2030, build the resilience of the poor and those in vulnerable situations and reduce their exposure and vulnerability to climate-related extreme events and other economic, social and environmental shocks and disasters"
33263310
},
3327-
{
3328-
"dcid": "dc/g/SDG_11.5",
3329-
"name": "11.5: By 2030, significantly reduce the number of deaths and the number of people affected and substantially decrease the direct economic losses relative to global gross domestic product caused by disasters, including water-related disasters, with a focus on protecting the poor and people in vulnerable situations"
3330-
},
33313311
{
33323312
"dcid": "sdg/g/SDG_11.5",
33333313
"name": "11.5: By 2030, significantly reduce the number of deaths and the number of people affected and substantially decrease the direct economic losses relative to global gross domestic product caused by disasters, including water-related disasters, with a focus on protecting the poor and people in vulnerable situations"
33343314
},
3335-
{
3336-
"dcid": "dc/g/SDG_12.c",
3337-
"name": "12.c: Rationalize inefficient fossil-fuel subsidies that encourage wasteful consumption by removing market distortions, in accordance with national circumstances, including by restructuring taxation and phasing out those harmful subsidies, where they exist, to reflect their environmental impacts, taking fully into account the specific needs and conditions of developing countries and minimizing the possible adverse impacts on their development in a manner that protects the poor and the affected communities"
3338-
},
33393315
{
33403316
"dcid": "sdg/g/SDG_12.c",
33413317
"name": "12.c: Rationalize inefficient fossil-fuel subsidies that encourage wasteful consumption by removing market distortions, in accordance with national circumstances, including by restructuring taxation and phasing out those harmful subsidies, where they exist, to reflect their environmental impacts, taking fully into account the specific needs and conditions of developing countries and minimizing the possible adverse impacts on their development in a manner that protects the poor and the affected communities"
33423318
},
3343-
{
3344-
"dcid": "dc/g/SDG_17.4",
3345-
"name": "17.4: Assist developing countries in attaining long-term debt sustainability through coordinated policies aimed at fostering debt financing, debt relief and debt restructuring, as appropriate, and address the external debt of highly indebted poor countries to reduce debt distress"
3346-
},
33473319
{
33483320
"dcid": "sdg/g/SDG_17.4",
33493321
"name": "17.4: Assist developing countries in attaining long-term debt sustainability through coordinated policies aimed at fostering debt financing, debt relief and debt restructuring, as appropriate, and address the external debt of highly indebted poor countries to reduce debt distress"
33503322
},
3351-
{
3352-
"dcid": "dc/g/SDG_2.1",
3353-
"name": "2.1: By 2030, end hunger and ensure access by all people, in particular the poor and people in vulnerable situations, including infants, to safe, nutritious and sufficient food all year round"
3354-
},
33553323
{
33563324
"dcid": "sdg/g/SDG_2.1",
33573325
"name": "2.1: By 2030, end hunger and ensure access by all people, in particular the poor and people in vulnerable situations, including infants, to safe, nutritious and sufficient food all year round"

internal/server/v1/page/place.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,8 @@ func getSimilarPlaces(
542542
}
543543
seed = int64(time.Now().YearDay() + int(h.Sum32()))
544544
}
545-
rand.Seed(seed)
546-
rand.Shuffle(len(places), func(i, j int) {
545+
r := rand.New(rand.NewSource(seed))
546+
r.Shuffle(len(places), func(i, j int) {
547547
places[i], places[j] = places[j], places[i]
548548
})
549549
result := []*pbv1.Place{}

internal/util/util.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,14 +237,14 @@ func CheckValidDCIDs(dcids []string) error {
237237

238238
// RandomString creates a random string with 16 runes.
239239
func RandomString() string {
240-
rand.Seed(time.Now().UnixNano())
240+
r := rand.New(rand.NewSource(time.Now().UnixNano()))
241241
chars := []rune("ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
242242
"abcdefghijklmnopqrstuvwxyz" +
243243
"0123456789")
244244
length := 16
245245
var b strings.Builder
246246
for i := 0; i < length; i++ {
247-
b.WriteRune(chars[rand.Intn(len(chars))])
247+
b.WriteRune(chars[r.Intn(len(chars))])
248248
}
249249
return b.String()
250250
}

0 commit comments

Comments
 (0)