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

allow immediate origin to be a 10 digits value #512

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 2 additions & 2 deletions fileHeader.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func (fh *FileHeader) Validate() error {
if err := fh.isAlphanumeric(fh.ImmediateDestinationName); err != nil {
return fieldError("ImmediateDestinationName", err, fh.ImmediateDestinationName)
}
if fh.ImmediateOrigin == "000000000" {
if fh.ImmediateOrigin == "0000000000" {
return fieldError("ImmediateOrigin", ErrConstructor, fh.ImmediateOrigin)
}
if fh.ImmediateDestination == "000000000" {
Expand Down Expand Up @@ -241,7 +241,7 @@ func (fh *FileHeader) ImmediateDestinationField() string {

// ImmediateOriginField gets the immediate origin number with 0 padding
func (fh *FileHeader) ImmediateOriginField() string {
return " " + fh.stringField(fh.ImmediateOrigin, 9)
return fh.stringField(fh.ImmediateOrigin, 10)
}

// FileCreationDateField gets the file creation date in YYMMDD format
Expand Down
4 changes: 2 additions & 2 deletions fileHeader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ func parseFileHeader(t testing.TB) {
if record.ImmediateDestinationField() != " 076401251" {
t.Errorf("ImmediateDestination Expected ' 076401251' got: %v", record.ImmediateDestinationField())
}
if record.ImmediateOriginField() != " 076401251" {
t.Errorf("ImmediateOrigin Expected ' 076401251' got: %v", record.ImmediateOriginField())
if record.ImmediateOriginField() != "0076401251" {
t.Errorf("ImmediateOrigin Expected ' 0076401251' got: %v", record.ImmediateOriginField())
}

if record.FileCreationDateField() != "180729" {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/go-logfmt/logfmt v0.4.0 // indirect
github.com/gorilla/mux v1.7.0
github.com/hashicorp/golang-lru v0.5.1 // indirect
github.com/moov-io/base v0.8.0
github.com/moov-io/base v0.9.0
github.com/prometheus/client_golang v0.9.2
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 // indirect
github.com/prometheus/common v0.2.0 // indirect
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0j
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/moov-io/base v0.8.0 h1:2GO0fr72ZK4vLgmQLkfCrOIS/o6MHT7wbSmqsqE1LTw=
github.com/moov-io/base v0.8.0/go.mod h1:pPu/TAc9PkaaegbREVEeDHsGqyAlvji9vqTuARuAnd0=
github.com/moov-io/base v0.9.0 h1:7bp5Jpola4EunGmOVVaw3WkWOqcSnyVZJEoOmYLKdhw=
github.com/moov-io/base v0.9.0/go.mod h1:pPu/TAc9PkaaegbREVEeDHsGqyAlvji9vqTuARuAnd0=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand All @@ -47,6 +49,7 @@ github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a h1:9a8MnZMP0X2nL
github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190219184716-e4d4a2206da0 h1:4+Tdy73otddqWxwK30bAMLH9ymeHQ1Y5+fmSoCF1XtU=
github.com/prometheus/procfs v0.0.0-20190219184716-e4d4a2206da0/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.0.0-20190228000957-bbced9601137 h1:SPWuMraeyEJ7vuPANbY+lqKqdJNpvFGaXES3M9oTWwI=
github.com/prometheus/procfs v0.0.0-20190228000957-bbced9601137/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/rickar/cal v1.0.0 h1:kb1QBxUDVz433Pw+NB4o6auW75d7HdsaD5ZsdnPdV/E=
github.com/rickar/cal v1.0.0/go.mod h1:3GBx8OBrvh4/y/JTxM0e1bUUIHMnqILl1rMANHWExxQ=
Expand Down