Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Go Get Fails on File Path Length in Windows #138

Closed
AKNucoder opened this issue Oct 27, 2018 · 3 comments · Fixed by #234
Closed

Go Get Fails on File Path Length in Windows #138

AKNucoder opened this issue Oct 27, 2018 · 3 comments · Fixed by #234
Labels

Comments

@AKNucoder
Copy link

AKNucoder commented Oct 27, 2018

Issue

When I try
PS> go get github.com/awslabs/goformation

I get the error:
go build github.com/awslabs/goformation/cloudformation: C:\Go\pkg\tool\windows_amd64\compile.exe: fork/exec C:\Go\pkg\tool\windows_amd64\compile.exe: The filename or extension is too long.

Background

I currently have my $env:GOPATH as:

PS> $env:GOPATH
C:\godir 

The file path to cloudformation:
C:\godir\src\github.com\awslabs\goformation\cloudformation

Environment

PS> go version
go version go1.10.3 windows/amd64

Windows 10

Other

I notice this issue appears similar to #37 (which had been resolved). As per #37, I realize that the Go compiler can't accept long file paths on Windows.

Does anyone else get this issue (on Windows)?

@PaulMaddox
Copy link
Contributor

PaulMaddox commented Oct 28, 2018

Do you know what the limit is?

I see a couple of possible solutions:

  1. Move all of the resource definitions into a single file. I don't like this approach as it massively detracts from the readability - however it's the approach some other similar libraries have taken.

  2. Move all of the property structs (cloudformation/*_*.go) into their parent file. For example, the AWSCloudFrontCloudFrontOriginAccessIdentity_CloudFrontOriginAccessIdentityConfig struct would be moved from cloudformation/aws-cloudfront-cloudfrontoriginaccessidentity_cloudfrontoriginaccessidentityconfig.go into the cloudformation/aws-cloudfront-cloudfrontoriginaccessidentity.go file that contains it's parent AWSCloudFrontCloudFrontOriginAccessIdentity struct.

These are the top 25 filenames by length today:

$ find cloudformation/*.go | awk '{ print length, $0 }' | sort -rn | head -25
100 cloudformation/aws-cloudfront-cloudfrontoriginaccessidentity_cloudfrontoriginaccessidentityconfig.go
99 cloudformation/aws-applicationautoscaling-scalingpolicy_targettrackingscalingpolicyconfiguration.go
93 cloudformation/aws-sagemaker-notebookinstancelifecycleconfig_notebookinstancelifecyclehook.go
91 cloudformation/aws-servicecatalog-cloudformationprovisionedproduct_provisioningparameter.go
91 cloudformation/aws-kinesisanalytics-applicationreferencedatasource_s3referencedatasource.go
91 cloudformation/aws-kinesisanalytics-applicationreferencedatasource_jsonmappingparameters.go
90 cloudformation/aws-kinesisfirehose-deliverystream_elasticsearchdestinationconfiguration.go
90 cloudformation/aws-kinesisanalytics-applicationreferencedatasource_csvmappingparameters.go
89 cloudformation/aws-servicecatalog-cloudformationproduct_provisioningartifactproperties.go
89 cloudformation/aws-kinesisanalytics-applicationreferencedatasource_referencedatasource.go
89 cloudformation/aws-applicationautoscaling-scalingpolicy_stepscalingpolicyconfiguration.go
88 cloudformation/aws-ssm-maintenancewindowtask_maintenancewindowstepfunctionsparameters.go
88 cloudformation/aws-applicationautoscaling-scalingpolicy_predefinedmetricspecification.go
88 cloudformation/aws-applicationautoscaling-scalingpolicy_customizedmetricspecification.go
87 cloudformation/aws-kinesisfirehose-deliverystream_extendeds3destinationconfiguration.go
87 cloudformation/aws-kinesisanalytics-applicationreferencedatasource_mappingparameters.go
87 cloudformation/aws-elasticbeanstalk-configurationtemplate_configurationoptionsetting.go
87 cloudformation/aws-autoscalingplans-scalingplan_predefinedscalingmetricspecification.go
87 cloudformation/aws-autoscalingplans-scalingplan_customizedscalingmetricspecification.go
85 cloudformation/aws-ssm-maintenancewindowtask_maintenancewindowruncommandparameters.go
85 cloudformation/aws-ssm-maintenancewindowtask_maintenancewindowautomationparameters.go
85 cloudformation/aws-ses-configurationseteventdestination_kinesisfirehosedestination.go
85 cloudformation/aws-kinesisfirehose-deliverystream_redshiftdestinationconfiguration.go
85 cloudformation/aws-kinesisfirehose-deliverystream_kinesisstreamsourceconfiguration.go
85 cloudformation/aws-kinesisanalytics-applicationreferencedatasource_referenceschema.go

If we implemented option 2, then this would drop down to 69

$ find cloudformation/*.go | grep -v _ | awk '{ print length, $0 }' | sort -rn | head -25
69 cloudformation/aws-servicecatalog-cloudformationprovisionedproduct.go
69 cloudformation/aws-kinesisanalytics-applicationreferencedatasource.go
66 cloudformation/aws-servicecatalog-portfolioprincipalassociation.go
65 cloudformation/aws-servicecatalog-launchnotificationconstraint.go
64 cloudformation/aws-servicecatalog-portfolioproductassociation.go
64 cloudformation/aws-elasticloadbalancingv2-listenercertificate.go
63 cloudformation/aws-sagemaker-notebookinstancelifecycleconfig.go
63 cloudformation/aws-cloudfront-cloudfrontoriginaccessidentity.go
61 cloudformation/aws-servicecatalog-launchtemplateconstraint.go
60 cloudformation/aws-opsworks-elasticloadbalancerattachment.go
60 cloudformation/aws-elasticbeanstalk-configurationtemplate.go
59 cloudformation/aws-servicecatalog-acceptedportfolioshare.go
59 cloudformation/aws-ec2-vpcendpointconnectionnotification.go
59 cloudformation/aws-cognito-userpoolusertogroupattachment.go
59 cloudformation/aws-applicationautoscaling-scalabletarget.go
58 cloudformation/aws-ses-configurationseteventdestination.go
58 cloudformation/aws-servicediscovery-privatednsnamespace.go
58 cloudformation/aws-servicecatalog-cloudformationproduct.go
58 cloudformation/aws-redshift-clustersecuritygroupingress.go
58 cloudformation/aws-applicationautoscaling-scalingpolicy.go
57 cloudformation/aws-servicediscovery-publicdnsnamespace.go
57 cloudformation/aws-servicecatalog-tagoptionassociation.go
57 cloudformation/aws-servicecatalog-launchroleconstraint.go
57 cloudformation/aws-elasticloadbalancingv2-loadbalancer.go
57 cloudformation/aws-elasticloadbalancingv2-listenerrule.go

The question I need to find the answer to, is whether this is enough...

@ph
Copy link

ph commented Oct 31, 2018

@PaulMaddox I just ran into that issue last week, in the end I've just merged every files into a single one, since they are machine generated and editor can just easily navigate between the file it worked for me. I think regrouping the struct per service should also work.

@PaulMaddox
Copy link
Contributor

🎉 This issue has been resolved in version 3.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

3 participants