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

Add go-vet shadow variable checking. #2042

Merged
merged 38 commits into from May 8, 2019

Conversation

chrisgilmerproj
Copy link
Contributor

@chrisgilmerproj chrisgilmerproj commented Apr 24, 2019

Description

We lost shadow variable checking when we moved from go tool vet to go vet. This PR fixes that oversight and any missed vars.

Reviewer Notes

Here are the problems I have to fix:

# github.com/transcom/mymove/cmd/ecs-service-logs
cmd/ecs-service-logs/main.go:287:10: declaration of "err" shadows declaration at line 271
# github.com/transcom/mymove/cmd/health_checker
cmd/health_checker/main.go:223:14: declaration of "err" shadows declaration at line 211
cmd/health_checker/main.go:254:14: declaration of "err" shadows declaration at line 242
# github.com/transcom/mymove/cmd/renderer
cmd/renderer/main.go:38:9: declaration of "err" shadows declaration at line 29
# github.com/transcom/mymove/pkg/auth
pkg/auth/cookie.go:120:11: declaration of "err" shadows declaration at line 113
# github.com/transcom/mymove/pkg/gen/dpsapi
pkg/gen/dpsapi/server.go:195:7: declaration of "err" shadows declaration at line 155
pkg/gen/dpsapi/server.go:225:7: declaration of "err" shadows declaration at line 155
# github.com/transcom/mymove/pkg/models
pkg/models/move.go:277:3: declaration of "verrs" shadows declaration at line 267
pkg/models/move.go:277:10: declaration of "err" shadows declaration at line 267
pkg/models/shipment_summary_worksheet.go:171:15: declaration of "err" shadows declaration at line 159
pkg/models/traffic_distribution_list.go:83:10: declaration of "err" shadows declaration at line 71
# github.com/transcom/mymove/pkg/gen/ordersapi
pkg/gen/ordersapi/server.go:195:7: declaration of "err" shadows declaration at line 155
pkg/gen/ordersapi/server.go:225:7: declaration of "err" shadows declaration at line 155
# github.com/transcom/mymove/pkg/uploader
pkg/uploader/uploader.go:99:10: declaration of "err" shadows declaration at line 50
# github.com/transcom/mymove/pkg/awardqueue
pkg/awardqueue/awardqueue.go:94:6: declaration of "err" shadows declaration at line 63
pkg/awardqueue/awardqueue.go:120:10: declaration of "err" shadows declaration at line 97
# github.com/transcom/mymove/cmd/generate_shipment_edi
cmd/generate_shipment_edi/main.go:98:26: declaration of "err" shadows declaration at line 59
cmd/generate_shipment_edi/main.go:167:22: declaration of "err" shadows declaration at line 125
# github.com/transcom/mymove/pkg/gen/internalapi
pkg/gen/internalapi/server.go:195:7: declaration of "err" shadows declaration at line 155
pkg/gen/internalapi/server.go:225:7: declaration of "err" shadows declaration at line 155
# github.com/transcom/mymove/pkg/gen/restapi
pkg/gen/restapi/server.go:195:7: declaration of "err" shadows declaration at line 155
pkg/gen/restapi/server.go:225:7: declaration of "err" shadows declaration at line 155
# github.com/transcom/mymove/pkg/paperwork
pkg/paperwork/generator.go:219:13: declaration of "err" shadows declaration at line 208
pkg/paperwork/generator_test.go:81:6: declaration of "err" shadows declaration at line 73
pkg/paperwork/generator_test.go:102:13: declaration of "err" shadows declaration at line 73
pkg/paperwork/shipment_summary_test.go:136:3: declaration of "params" shadows declaration at line 83
# github.com/transcom/mymove/pkg/rateengine
pkg/rateengine/nonlinehaul.go:150:13: declaration of "err" shadows declaration at line 118
# github.com/transcom/mymove/cmd/milmove
cmd/milmove/main.go:866:9: declaration of "err" shadows declaration at line 837
cmd/milmove/main.go:875:5: declaration of "err" shadows declaration at line 870
cmd/milmove/main.go:918:8: declaration of "err" shadows declaration at line 837
cmd/milmove/main.go:921:8: declaration of "err" shadows declaration at line 837
cmd/milmove/main.go:991:15: declaration of "err" shadows declaration at line 837
cmd/milmove/main.go:1166:3: declaration of "err" shadows declaration at line 837
cmd/milmove/main.go:1342:15: declaration of "err" shadows declaration at line 837
# github.com/transcom/mymove/pkg/services/fuelprice
pkg/services/fuelprice/diesel_fuel_price_storer.go:99:12: declaration of "err" shadows declaration at line 78
pkg/services/fuelprice/diesel_fuel_price_storer.go:125:3: declaration of "verrs" shadows declaration at line 77
pkg/services/fuelprice/diesel_fuel_price_storer.go:178:14: declaration of "err" shadows declaration at line 158
pkg/services/fuelprice/diesel_fuel_price_storer_test.go:79:10: declaration of "err" shadows declaration at line 61
pkg/services/fuelprice/diesel_fuel_price_storer_test.go:94:10: declaration of "err" shadows declaration at line 61
pkg/services/fuelprice/diesel_fuel_price_storer_test.go:107:10: declaration of "err" shadows declaration at line 61
pkg/services/fuelprice/diesel_fuel_price_storer_test.go:115:10: declaration of "err" shadows declaration at line 61
pkg/services/fuelprice/diesel_fuel_price_storer_test.go:122:10: declaration of "err" shadows declaration at line 61
pkg/services/fuelprice/diesel_fuel_price_storer_test.go:129:10: declaration of "err" shadows declaration at line 61
# github.com/transcom/mymove/pkg/services/invoice
pkg/services/invoice/process_invoice.go:30:10: declaration of "err" shadows declaration at line 27
pkg/services/invoice/process_invoice.go:39:3: declaration of "verrs" shadows declaration at line 35
pkg/services/invoice/process_invoice.go:39:10: declaration of "err" shadows declaration at line 27
# github.com/transcom/mymove/pkg/services/shipment
pkg/services/shipment/price_shipment.go:67:10: declaration of "err" shadows declaration at line 47
pkg/services/shipment/recalculate_shipment_test.go:92:4: declaration of "err" shadows declaration at line 74
# github.com/transcom/mymove/pkg/unit
pkg/unit/base_quantity_test.go:8:2: declaration of "BaseQuantity" shadows declaration at line 21
pkg/unit/base_quantity_test.go:18:2: declaration of "BaseQuantity" shadows declaration at line 21
pkg/unit/base_quantity_test.go:28:2: declaration of "BaseQuantity" shadows declaration at line 21
pkg/unit/base_quantity_test.go:38:2: declaration of "BaseQuantity" shadows declaration at line 21
pkg/unit/base_quantity_test.go:48:2: declaration of "BaseQuantity" shadows declaration at line 21
# github.com/transcom/mymove/cmd/generate_test_data
cmd/generate_test_data/main.go:69:12: declaration of "err" shadows declaration at line 28
cmd/generate_test_data/main.go:78:11: declaration of "err" shadows declaration at line 28
# github.com/transcom/mymove/pkg/handlers/publicapi
pkg/handlers/publicapi/generic_move_documents.go:112:11: declaration of "err" shadows declaration at line 82
pkg/handlers/publicapi/service_agents.go:146:12: declaration of "err" shadows declaration at line 138
pkg/handlers/publicapi/shipment_line_items.go:422:9: declaration of "err" shadows declaration at line 403
pkg/handlers/publicapi/shipment_line_items.go:428:6: declaration of "err" shadows declaration at line 403
pkg/handlers/publicapi/shipments.go:160:12: declaration of "err" shadows declaration at line 154
pkg/handlers/publicapi/shipments.go:574:12: declaration of "err" shadows declaration at line 567
pkg/handlers/publicapi/transportation_service_provider.go:48:12: declaration of "err" shadows declaration at line 42
# github.com/transcom/mymove/pkg/handlers/internalapi
pkg/handlers/internalapi/generic_move_documents.go:70:11: declaration of "err" shadows declaration at line 54
pkg/handlers/internalapi/generic_move_documents.go:82:8: declaration of "err" shadows declaration at line 54
pkg/handlers/internalapi/move_documents.go:164:5: declaration of "err" shadows declaration at line 130
pkg/handlers/internalapi/moving_expense_documents.go:73:11: declaration of "err" shadows declaration at line 57
pkg/handlers/internalapi/moving_expense_documents.go:85:8: declaration of "err" shadows declaration at line 57
pkg/handlers/internalapi/personally_procured_move.go:406:19: declaration of "err" shadows declaration at line 397

Setup

Add any steps or code to run in this section to help others prepare to run your code:

pre-commit run -a go-vet

Code Review Verification Steps

  • Deploy to experimental
  • Request review from a member of a different team.
  • Have the Pivotal acceptance criteria been met for this change?

References

@chrisgilmerproj chrisgilmerproj self-assigned this Apr 24, 2019
@codecov
Copy link

codecov bot commented Apr 24, 2019

Codecov Report

Merging #2042 into master will increase coverage by 0.03%.
The diff coverage is 36.72%.

@@            Coverage Diff             @@
##           master    #2042      +/-   ##
==========================================
+ Coverage   60.26%   60.29%   +0.03%     
==========================================
  Files         229      230       +1     
  Lines       13331    13342      +11     
==========================================
+ Hits         8033     8044      +11     
  Misses       4326     4326              
  Partials      972      972

@chrisgilmerproj chrisgilmerproj marked this pull request as ready for review April 25, 2019 20:27
# Get directory of script in order to get directory of project
# This allows the script to work from any sub directory in the project
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}/" )" >/dev/null 2>&1 && pwd )"
DIR="$(dirname "${DIR}")"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chrisrcoles - this ought to fix the problem you saw today.

@chrisgilmerproj
Copy link
Contributor Author

This works on experimental. But I saw a failure with the awardqueue and I'm worried about it. So I'm going to check that out first and try to find out what's up.

@chrisgilmerproj
Copy link
Contributor Author

This works on experimental. But I saw a failure with the awardqueue and I'm worried about it. So I'm going to check that out first and try to find out what's up.

Subsequent reruns worked. Though please give a closer look if you can and try to catch anything I messed up.

@@ -582,7 +582,7 @@ func showFunction(cmd *cobra.Command, args []string) error {
}

if level := strings.ToLower(v.GetString(flagLogLevel)); len(level) > 0 {
filters[logLevel] = level
filters[filterLogLevel] = level
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pjdufour-truss - found this shadow variable and was hoping you'd take a look at it. I think I made the appropriate fix.

@chrisgilmerproj
Copy link
Contributor Author

@akostibas - I keep seeing this problem with the award queue. Any idea what's up with this?

2019-05-03T21:03:40.940Z	INFO	awardqueue/awardqueue.go:158	TSP Award Queue running.
2019-05-03T21:03:40.945Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "a04abc47-b5a4-4879-997b-3e39e6fabbc9", "traffic_distribution_list_id": "b56228f3-47df-4794-aadf-ad95bc4741f2"}
2019-05-03T21:03:40.965Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "e777c01b-606b-4cd7-87cb-e46617fbaf4d"}
2019-05-03T21:03:40.982Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 1}
2019-05-03T21:03:41.010Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "040878d2-06d0-4e1a-9680-08923eea51ca", "traffic_distribution_list_id": "b56228f3-47df-4794-aadf-ad95bc4741f2"}
2019-05-03T21:03:41.029Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "e777c01b-606b-4cd7-87cb-e46617fbaf4d"}
2019-05-03T21:03:41.044Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 2}
2019-05-03T21:03:41.073Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "16799be3-30f8-47a8-a924-e9c9c6340a6b", "traffic_distribution_list_id": "b56228f3-47df-4794-aadf-ad95bc4741f2"}
2019-05-03T21:03:41.092Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "e777c01b-606b-4cd7-87cb-e46617fbaf4d"}
2019-05-03T21:03:41.107Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 3}
2019-05-03T21:03:41.136Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "5ed7a448-2fd3-4f1d-a1db-0b50c6c8e30b", "traffic_distribution_list_id": "b56228f3-47df-4794-aadf-ad95bc4741f2"}
2019-05-03T21:03:41.156Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "e777c01b-606b-4cd7-87cb-e46617fbaf4d"}
2019-05-03T21:03:41.174Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 4}
2019-05-03T21:03:41.213Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "66a6a7c5-b3fd-4560-9af1-a038d83bfc87", "traffic_distribution_list_id": "b56228f3-47df-4794-aadf-ad95bc4741f2"}
2019-05-03T21:03:41.233Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "e777c01b-606b-4cd7-87cb-e46617fbaf4d"}
2019-05-03T21:03:41.257Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 5}
2019-05-03T21:03:41.290Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "2febba16-1f13-4f47-8dac-539f6eb46807", "traffic_distribution_list_id": "b56228f3-47df-4794-aadf-ad95bc4741f2"}
2019-05-03T21:03:41.310Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "e777c01b-606b-4cd7-87cb-e46617fbaf4d"}
2019-05-03T21:03:41.334Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 6}
2019-05-03T21:03:41.369Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "cde90886-e407-4580-a8d5-ca57e17ba031", "traffic_distribution_list_id": "b56228f3-47df-4794-aadf-ad95bc4741f2"}
2019-05-03T21:03:41.389Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "e777c01b-606b-4cd7-87cb-e46617fbaf4d"}
2019-05-03T21:03:41.415Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 7}
2019-05-03T21:03:41.449Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "6bae49a7-a444-437d-aae5-fc4bef11a368", "traffic_distribution_list_id": "b56228f3-47df-4794-aadf-ad95bc4741f2"}
2019-05-03T21:03:41.470Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "e777c01b-606b-4cd7-87cb-e46617fbaf4d"}
2019-05-03T21:03:41.499Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 8}
2019-05-03T21:03:41.533Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "89ed0f34-faea-494f-ad3d-4a8c9a9feeff", "traffic_distribution_list_id": "b56228f3-47df-4794-aadf-ad95bc4741f2"}
2019-05-03T21:03:41.553Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "e777c01b-606b-4cd7-87cb-e46617fbaf4d"}
2019-05-03T21:03:41.580Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 9}
2019-05-03T21:03:41.645Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "53036d4b-f859-4eea-be2c-3119b5fc3a47", "traffic_distribution_list_id": "b56228f3-47df-4794-aadf-ad95bc4741f2"}
2019-05-03T21:03:41.691Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "e777c01b-606b-4cd7-87cb-e46617fbaf4d"}
2019-05-03T21:03:41.731Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 10}
2019-05-03T21:03:41.777Z	INFO	awardqueue/awardqueue.go:173	Awarded some shipments.	{"shipments_awarded": 10, "shipments_unawarded": 0}
2019-05-03T21:03:45.505Z	INFO	awardqueue/awardqueue.go:158	TSP Award Queue running.
2019-05-03T21:03:45.509Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "f1da198a-51d1-4d45-bc49-4c83de60377d", "traffic_distribution_list_id": "b8095e74-0909-4dd4-9612-53f99663e0cb"}
2019-05-03T21:03:45.529Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "e557a63a-b3c7-4418-9ddf-520579838755"}
2019-05-03T21:03:45.545Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 1}
2019-05-03T21:03:45.575Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "e37d2d9f-604a-40a8-a751-bd3a1602daa1", "traffic_distribution_list_id": "b8095e74-0909-4dd4-9612-53f99663e0cb"}
2019-05-03T21:03:45.595Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "99adb0a4-ceae-4e1c-8b5c-a7f4cfa766c1"}
2019-05-03T21:03:45.610Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 1}
2019-05-03T21:03:45.642Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "ff600170-429f-4fbe-af3e-8b4fd7a80219", "traffic_distribution_list_id": "b8095e74-0909-4dd4-9612-53f99663e0cb"}
2019-05-03T21:03:45.662Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "378ecdca-173a-4127-9f63-6afe07fd9081"}
2019-05-03T21:03:45.678Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 1}
2019-05-03T21:03:45.710Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "d447f5ab-18a2-4158-a3e0-4e283b844835", "traffic_distribution_list_id": "b8095e74-0909-4dd4-9612-53f99663e0cb"}
2019-05-03T21:03:45.730Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "7a0f972b-3f88-4050-92cd-1595b63d5793"}
2019-05-03T21:03:45.746Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 1}
2019-05-03T21:03:45.776Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "17258c7a-3ccb-4973-8b58-1d318dd33402", "traffic_distribution_list_id": "b8095e74-0909-4dd4-9612-53f99663e0cb"}
2019-05-03T21:03:45.797Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "121c2ea6-d71c-4305-a151-905ec6f75607"}
2019-05-03T21:03:45.814Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 1}
2019-05-03T21:03:45.845Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "22f964f6-0533-4b7c-ba17-b98c81d852e6", "traffic_distribution_list_id": "b8095e74-0909-4dd4-9612-53f99663e0cb"}
2019-05-03T21:03:45.867Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "121c2ea6-d71c-4305-a151-905ec6f75607"}
2019-05-03T21:03:45.883Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 2}
2019-05-03T21:03:45.912Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "e190c816-c235-43ad-bd38-9cff09b0e51a", "traffic_distribution_list_id": "b8095e74-0909-4dd4-9612-53f99663e0cb"}
2019-05-03T21:03:45.931Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "7a0f972b-3f88-4050-92cd-1595b63d5793"}
2019-05-03T21:03:45.946Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 2}
2019-05-03T21:03:45.975Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "1948c328-d02c-4aba-91d8-b9662dd5fc97", "traffic_distribution_list_id": "b8095e74-0909-4dd4-9612-53f99663e0cb"}
2019-05-03T21:03:45.995Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "378ecdca-173a-4127-9f63-6afe07fd9081"}
2019-05-03T21:03:46.010Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 2}
2019-05-03T21:03:46.039Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "bb88951c-1e2b-4680-8ffc-f4fe51093de2", "traffic_distribution_list_id": "b8095e74-0909-4dd4-9612-53f99663e0cb"}
2019-05-03T21:03:46.060Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "99adb0a4-ceae-4e1c-8b5c-a7f4cfa766c1"}
2019-05-03T21:03:46.076Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 2}
2019-05-03T21:03:46.107Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "651e98fb-b50b-419f-832f-7bd2ca1ff682", "traffic_distribution_list_id": "b8095e74-0909-4dd4-9612-53f99663e0cb"}
2019-05-03T21:03:46.129Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "e557a63a-b3c7-4418-9ddf-520579838755"}
2019-05-03T21:03:46.144Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 2}
2019-05-03T21:03:46.174Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "7112f0cb-41c4-4bf6-97a9-37ef97edac96", "traffic_distribution_list_id": "b8095e74-0909-4dd4-9612-53f99663e0cb"}
2019-05-03T21:03:46.194Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "e557a63a-b3c7-4418-9ddf-520579838755"}
2019-05-03T21:03:46.210Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 3}
2019-05-03T21:03:46.241Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "78d98dbf-eb05-4c77-8d83-ec6210814984", "traffic_distribution_list_id": "b8095e74-0909-4dd4-9612-53f99663e0cb"}
2019-05-03T21:03:46.263Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "99adb0a4-ceae-4e1c-8b5c-a7f4cfa766c1"}
2019-05-03T21:03:46.281Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 3}
2019-05-03T21:03:46.314Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "aa75c1b3-1606-4194-b166-3309c302bc5d", "traffic_distribution_list_id": "b8095e74-0909-4dd4-9612-53f99663e0cb"}
2019-05-03T21:03:46.337Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "378ecdca-173a-4127-9f63-6afe07fd9081"}
2019-05-03T21:03:46.354Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 3}
2019-05-03T21:03:46.386Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "5a61ccd8-a974-4000-8c6b-c7b523e158eb", "traffic_distribution_list_id": "b8095e74-0909-4dd4-9612-53f99663e0cb"}
2019-05-03T21:03:46.406Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "7a0f972b-3f88-4050-92cd-1595b63d5793"}
2019-05-03T21:03:46.423Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 3}
2019-05-03T21:03:46.454Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "78c76db2-2c95-424f-a09e-80ecac7dadf0", "traffic_distribution_list_id": "b8095e74-0909-4dd4-9612-53f99663e0cb"}
2019-05-03T21:03:46.476Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "121c2ea6-d71c-4305-a151-905ec6f75607"}
2019-05-03T21:03:46.492Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 3}
2019-05-03T21:03:46.524Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "4f5cbaee-8b50-4a21-81f4-4347617f1ddf", "traffic_distribution_list_id": "b8095e74-0909-4dd4-9612-53f99663e0cb"}
2019-05-03T21:03:46.544Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "121c2ea6-d71c-4305-a151-905ec6f75607"}
2019-05-03T21:03:46.561Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 4}
2019-05-03T21:03:46.590Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "954a0558-071c-4293-86bc-ba1ca2c65587", "traffic_distribution_list_id": "b8095e74-0909-4dd4-9612-53f99663e0cb"}
2019-05-03T21:03:46.611Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "7a0f972b-3f88-4050-92cd-1595b63d5793"}
2019-05-03T21:03:46.627Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 4}
2019-05-03T21:03:46.656Z	INFO	awardqueue/awardqueue.go:173	Awarded some shipments.	{"shipments_awarded": 17, "shipments_unawarded": 0}
2019-05-03T21:03:47.079Z	INFO	awardqueue/awardqueue.go:226	Assigning performance bands	{"traffic_distribution_list_id": "4a6fba19-b119-478f-a563-01c73fdabb9a", "performance_period_start": "2018-05-15 00:00:00 +0000 +0000", "performance_period_end": "2018-07-31 00:00:00 +0000 +0000", "rate_cycle_start": "2018-05-15 00:00:00 +0000 +0000", "rate_cycle_end": "2018-09-30 00:00:00 +0000 +0000"}
2019-05-03T21:03:47.083Z	INFO	awardqueue/awardqueue.go:244	Assigning tspPerformance to band	{"tsp_performance_id": "654dce69-8e4a-4ed2-ba5c-b1f1f6f871b6", "band": 1}
2019-05-03T21:03:47.089Z	INFO	awardqueue/awardqueue.go:244	Assigning tspPerformance to band	{"tsp_performance_id": "73dbc6c4-8965-443e-a431-8ebf9f2fe07f", "band": 1}
2019-05-03T21:03:47.094Z	INFO	awardqueue/awardqueue.go:244	Assigning tspPerformance to band	{"tsp_performance_id": "8baeeca1-91e5-4ca8-a7fa-c5e107d4ff0d", "band": 2}
2019-05-03T21:03:47.100Z	INFO	awardqueue/awardqueue.go:244	Assigning tspPerformance to band	{"tsp_performance_id": "da550ffd-1ff9-4143-be4d-24c17b08b6f4", "band": 3}
2019-05-03T21:03:47.106Z	INFO	awardqueue/awardqueue.go:244	Assigning tspPerformance to band	{"tsp_performance_id": "81df0e4f-9a67-4ee4-9b78-50ed1c9fae75", "band": 4}
2019-05-03T21:03:47.766Z	INFO	awardqueue/awardqueue.go:158	TSP Award Queue running.
2019-05-03T21:03:47.770Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "43789da1-f852-45e4-9544-4eaa4e00b6ab", "traffic_distribution_list_id": "5871954b-6353-4e24-918b-c617f15584d2"}
2019-05-03T21:03:47.788Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "17816353-7e2c-43aa-8a82-aabea73b0013"}
2019-05-03T21:03:47.802Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 1}
2019-05-03T21:03:47.830Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "78fec67a-bff6-41aa-bfbf-34da9b1d0fd7", "traffic_distribution_list_id": "5871954b-6353-4e24-918b-c617f15584d2"}
2019-05-03T21:03:47.848Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "eb7b3b50-b4f5-4642-b4cd-df2680078a1c"}
2019-05-03T21:03:47.863Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 1}
2019-05-03T21:03:47.891Z	INFO	awardqueue/awardqueue.go:173	Awarded some shipments.	{"shipments_awarded": 2, "shipments_unawarded": 0}
2019-05-03T21:03:48.448Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "20d0c4ad-bd9c-418c-8a4a-1dc02f934f20", "traffic_distribution_list_id": "b040b878-b40b-42a7-a31d-a15f277299ea"}
2019-05-03T21:03:48.468Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "2f4d0020-8bad-4803-91ff-60ee37336a90"}
2019-05-03T21:03:48.483Z	INFO	awardqueue/awardqueue.go:109	Shipment pickup date is during a blackout period. Awarding Administrative Shipment to TSP.
2019-05-03T21:03:48.483Z	INFO	awardqueue/awardqueue.go:136	Selected TSP has blackouts. Checking for another TSP.
2019-05-03T21:03:49.152Z	INFO	awardqueue/awardqueue.go:158	TSP Award Queue running.
2019-05-03T21:03:49.157Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "6643340b-a0c0-4324-bc63-8f4839bc327e", "traffic_distribution_list_id": "1748502f-5c67-4316-bffd-3cb1fa65b190"}
2019-05-03T21:03:49.176Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "6da43b98-cb86-4688-98d9-bb901840f012"}
2019-05-03T21:03:49.191Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 1}
2019-05-03T21:03:49.221Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "23ee72e9-d552-43ad-9816-286518657d61", "traffic_distribution_list_id": "1748502f-5c67-4316-bffd-3cb1fa65b190"}
2019-05-03T21:03:49.240Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "6da43b98-cb86-4688-98d9-bb901840f012"}
2019-05-03T21:03:49.254Z	INFO	awardqueue/awardqueue.go:109	Shipment pickup date is during a blackout period. Awarding Administrative Shipment to TSP.
2019-05-03T21:03:49.254Z	INFO	awardqueue/awardqueue.go:136	Selected TSP has blackouts. Checking for another TSP.
2019-05-03T21:03:49.267Z	ERROR	awardqueue/awardqueue.go:167	Failed to offer shipment	{"error": "could not find a TSP without blackout dates in 1 tries"}
github.com/transcom/mymove/pkg/logging/hnyzap.(*Logger).TraceError
	/home/circleci/go/src/github.com/transcom/mymove/pkg/logging/hnyzap/hnyzap.go:95
github.com/transcom/mymove/pkg/awardqueue.(*AwardQueue).assignShipments
	/home/circleci/go/src/github.com/transcom/mymove/pkg/awardqueue/awardqueue.go:167
github.com/transcom/mymove/pkg/awardqueue.(*AwardQueueSuite).Test_CheckShipmentDuringBlackOut
	/home/circleci/go/src/github.com/transcom/mymove/pkg/awardqueue/awardqueue_test.go:149
reflect.Value.call
	/usr/local/go/src/reflect/value.go:447
reflect.Value.Call
	/usr/local/go/src/reflect/value.go:308
github.com/stretchr/testify/suite.Run.func2
	/home/circleci/go/pkg/mod/github.com/stretchr/testify@v1.3.0/suite/suite.go:126
testing.tRunner
	/usr/local/go/src/testing/testing.go:865
2019-05-03T21:03:49.267Z	INFO	awardqueue/awardqueue.go:173	Awarded some shipments.	{"shipments_awarded": 1, "shipments_unawarded": 1}
2019-05-03T21:03:49.830Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "12f669fb-2d3b-4661-a586-3bf4ec1866c5", "traffic_distribution_list_id": "f73f7b96-994c-4c1d-93f9-cba3c27b2b2c"}
2019-05-03T21:03:51.344Z	INFO	awardqueue/awardqueue.go:57	Attempting to offer shipment	{"shipment_id": "86cc3584-63a0-4b4b-a99b-3ff33faf98fc", "traffic_distribution_list_id": "3733e61c-1d56-4075-b57d-45fae2a82c83"}
2019-05-03T21:03:51.363Z	INFO	awardqueue/awardqueue.go:95	Attempting to offer to TSP	{"tsp_id": "860018c3-4376-437c-8b7f-9182f5d63954"}
2019-05-03T21:03:51.379Z	INFO	awardqueue/awardqueue.go:116	Shipment offered to TSP!	{"quality_band": 1, "offer_count": 1}
--- FAIL: TestAwardQueueSuite (16.51s)
    --- FAIL: TestAwardQueueSuite/Test_AssignTSPsToBands (0.37s)
        awardqueue_test.go:647: Wrong quality band: expected 1, got 4
        awardqueue_test.go:647: Wrong quality band: expected 1, got 3
        awardqueue_test.go:647: Wrong quality band: expected 3, got 1
        awardqueue_test.go:647: Wrong quality band: expected 4, got 1
FAIL
coverage: 76.3% of statements
FAIL	github.com/transcom/mymove/pkg/awardqueue	16.554s

@chrisgilmerproj
Copy link
Contributor Author

Turns out the awardqueue problem wasn't part of this PR. It was fixed in #2093

@chrisgilmerproj chrisgilmerproj requested review from mikena-truss, reggieriser and ralren and removed request for akostibas, sarboc, jacquelineIO and jim May 7, 2019 18:04
h.Logger().Error("DB Query", zap.Error(err))
tspUser, fetchTSPByUserErr := models.FetchTspUserByID(h.DB(), session.TspUserID)
if fetchTSPByUserErr != nil {
h.Logger().Error("DB Query", zap.Error(fetchTSPByUserErr))
// return tspop.NewGetTransporationServiceProviderForbidden()
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's some code below this that uses the err but doesn't shadow. Your fix is fine, but just noting that it feels a little odd when we're using the err from the earlier scope, but only on the second call in this block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go-vet isn't perfect, I'm pretty sure it just uses statistical modeling to find these things. But in at least a few cases it caught real problems with the code and I'm happy with that result.

Copy link
Contributor

@reggieriser reggieriser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants