msgraph-beta-sdk-go icon indicating copy to clipboard operation
msgraph-beta-sdk-go copied to clipboard

file name too long repeats

Open universam1 opened this issue 1 year ago • 5 comments

Issue #260 is not resolved yet, the error appears when run inside a container:

go: unzip /go/pkg/mod/cache/download/github.com/microsoftgraph/msgraph-beta-sdk-go/@v/v0.88.0.zip: 
open /go/pkg/mod/github.com/microsoftgraph/[email protected]/identitygovernance/entitlement_management_access_package_catalogs_item_access_package_resource_roles_item_access_package_resource_access_package_resource_scopes_item_access_package_resource_access_package_resource_roles_access_package_resource_role_item_request_builder.go: 
file name too long

universam1 avatar Dec 18 '23 10:12 universam1

Hi @universam1 Can you share a bit more about your container setup and a set of steps to reproduce the issue please? Thanks!

baywet avatar Dec 18 '23 14:12 baywet

Hi @baywet , thanks for checking back!

I put a simple scenario together that replicates the problem on my machine, Ubuntu 23.10 using Podman. Not sure if that holds true for Docker though.

podman run -it --rm -w /tmp golang:1.21-alpine ash -c '
mkdir /src
cd /src
cat <<EOF > go.mod
module test
go 1.21
require ()
EOF
cat <<EOF > main.go
package main

import (
	msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
	"github.com/microsoftgraph/msgraph-beta-sdk-go/models"
	"github.com/microsoftgraph/msgraph-beta-sdk-go/sites"
)

func main() {
fmt.Println("Hello, World!")
}
EOF
go mod tidy
'

That results in

go: downloading github.com/microsoftgraph/msgraph-beta-sdk-go v0.88.0
-> unzip /go/pkg/mod/cache/download/github.com/microsoftgraph/msgraph-beta-sdk-go/@v/v0.88.0.zip: open /go/pkg/mod/github.com/microsoftgraph/[email protected]/identitygovernance/entitlement_management_access_package_catalogs_item_access_package_resource_roles_item_access_package_resource_access_package_resource_scopes_item_access_package_resource_access_package_resource_roles_access_package_resource_role_item_request_builder.go: file name too long
go: test imports
        github.com/microsoftgraph/msgraph-beta-sdk-go: unzip /go/pkg/mod/cache/download/github.com/microsoftgraph/msgraph-beta-sdk-go/@v/v0.88.0.zip: open /go/pkg/mod/github.com/microsoftgraph/[email protected]/identitygovernance/entitlement_management_access_package_catalogs_item_access_package_resource_roles_item_access_package_resource_access_package_resource_scopes_item_access_package_resource_access_package_resource_roles_access_package_resource_role_item_request_builder.go: file name too long
go: test imports
        github.com/microsoftgraph/msgraph-beta-sdk-go/models: unzip /go/pkg/mod/cache/download/github.com/microsoftgraph/msgraph-beta-sdk-go/@v/v0.88.0.zip: open /go/pkg/mod/github.com/microsoftgraph/[email protected]/identitygovernance/entitlement_management_access_package_catalogs_item_access_package_resource_roles_item_access_package_resource_access_package_resource_scopes_item_access_package_resource_access_package_resource_roles_access_package_resource_role_item_request_builder.go: file name too long
go: test imports
        github.com/microsoftgraph/msgraph-beta-sdk-go/sites: unzip /go/pkg/mod/cache/download/github.com/microsoftgraph/msgraph-beta-sdk-go/@v/v0.88.0.zip: open /go/pkg/mod/github.com/microsoftgraph/[email protected]/identitygovernance/entitlement_management_access_package_catalogs_item_access_package_resource_roles_item_access_package_resource_access_package_resource_scopes_item_access_package_resource_access_package_resource_roles_access_package_resource_role_item_request_builder.go: file name too long

Hope that helps!

universam1 avatar Dec 19 '23 08:12 universam1

Thanks for the repro here. the current limit for the file name is 251 characters

Note: that limit applies on the file name, not the whole path.

But that doesn't account for the fact that in most cases, people will already have some kind of prefix (project structure, location of package cache), for example: /go/pkg/mod/github.com/microsoftgraph/[email protected]/identitygovernance/entitlement_management_access_package_catalogs_item_access_package_resource_roles_item_access_package_resource_access_package_resource_scopes_item_access_package_resource_access_package_resource_roles_access_package_resource_role_item_request_builder.go is 338 characters long

already 65 characters are used by the package cache conventions, also 20 characters are used by the main directory name (identitygovernance). ~85 total. With a safety margin, I'd recommend to reduce the number by 100, to 155.

With that in mind, would you be willing to submit a pull request on the generator to address this?

baywet avatar Dec 19 '23 13:12 baywet

Thanks @baywet for your analyze, this sounds like the problem. Since I have no c# experience I would not dare to make this change, would you be able to?

universam1 avatar Dec 26 '23 15:12 universam1

@rkodev can you take this over please?

baywet avatar Jan 08 '24 13:01 baywet

Hi @universam1, as of release 0.106.0 this issue should be resolved

rkodev avatar Jul 15 '24 09:07 rkodev