Unmarking file with "-linguist-generated" broken in GitHub Preview #7661
Replies: 3 comments 13 replies
-
|
The The most likely explanation is the file isn't only being considered as generated by Linguist and there is something else at play - most likely it's also being considered vendored, which means you'll need to use two overrides. You've not provided a link to a repo experiencing this issue so I did a search for ➜ head -5 graphik/gql/schema.resolvers.go
package gql
// This file will be automatically regenerated based on the schema, any resolver implementations
// will be copied through when generating and any unknown code will be moved to the end.
➜ github-linguist graphik/gql/schema.resolvers.go
graphik/gql/schema.resolvers.go: 718 lines (670 sloc)
type: Text
mime type: text/plain
language: Go
➜ github-linguist graphik/ --breakdown | grep resolvers.go
gql/schema.resolvers.go
➜Great! It's not considered generated without that line. Lets add the line: ➜ vi graphik/gql/schema.resolvers.go
➜ git -C graphik commit -m 'Add generated by'
[master efd7ceb] Add generated by
1 file changed, 9 insertions(+), 5 deletions(-)
➜ head -5 graphik/gql/schema.resolvers.go
package gql
// This file will be automatically regenerated based on the schema, any resolver implementations
// will be copied through when generating and any unknown code will be moved to the end.
// Code generated by github.com/99designs/gqlgen version v0.17.74
➜ github-linguist graphik/gql/schema.resolvers.go
graphik/gql/schema.resolvers.go: 722 lines (673 sloc)
type: Text
mime type: text/plain
language: Go
appears to be generated source code
➜ github-linguist graphik/ --breakdown | grep resolvers.go
➜ Great! It's now being considered generated. Lets override linguist using ➜ echo "\n**/*.resolvers.go -linguist-generated" >> graphik/.gitattributes
➜ cat graphik/.gitattributes
/gen/grpc/csharp/* linguist-vendored
/gen/grpc/js/* linguist-vendored
/gen/grpc/java/* linguist-vendored
/gen/grpc/python/* linguist-vendored
/gen/grpc/php/* linguist-vendored
/gen/gql/docs/* linguist-vendored
/gen/grpc/docs/* linguist-vendored
**/*.resolvers.go -linguist-generated
➜ git -C graphik add .
➜ git -C graphik commit -m 'Add override'
[master 4393b2c] Add override
1 file changed, 2 insertions(+), 1 deletion(-)
➜ github-linguist graphik/gql/schema.resolvers.go
graphik/gql/schema.resolvers.go: 722 lines (673 sloc)
type: Text
mime type: text/plain
language: Go
➜ github-linguist graphik/ --breakdown | grep resolvers.go
gql/schema.resolvers.go
➜ And 🎉 the As I mentioned before, something else is likely at play. If you can provide a link to a repo experiencing the problem, I can take a look and provide an explanation. |
Beta Was this translation helpful? Give feedback.
-
|
Hi @lildude, here is a minimal example where the issue appears: https://github.com/HaraldNordgren/linguist-issue/pull/1/files |
Beta Was this translation helpful? Give feedback.
-
|
Hey, you deleted your comment whilst I was repling so I'll reply anyway 😁
🤨 It most definitely does work: ➜ cat graphik/.gitattributes
/gen/grpc/csharp/* linguist-vendored
/gen/grpc/js/* linguist-vendored
/gen/grpc/java/* linguist-vendored
/gen/grpc/python/* linguist-vendored
/gen/grpc/php/* linguist-vendored
/gen/gql/docs/* linguist-vendored
/gen/grpc/docs/* linguist-vendored
**/*.resolvers.go linguist-generated=false
➜ github-linguist graphik/gql/schema.resolvers.go
graphik/gql/schema.resolvers.go: 722 lines (673 sloc)
type: Text
mime type: text/plain
language: Go
➜ github-linguist graphik/ --breakdown | grep resolvers.go
gql/schema.resolvers.go
➜ The use of
So if you're going to propose a change to the docs, I'd recommend using the formal approach, not the Linguist-specific approach. It's what we document in our own project docs. |
Beta Was this translation helpful? Give feedback.



Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
-linguist-generatedto unmark files doesn't work.Have a file starting like this and try to get linguist NOT to see it as a generated file:
Expected behaviour
File is not marked as generated anymore.
Related discussion
99designs/gqlgen#3763
Additional notes
Beta Was this translation helpful? Give feedback.
All reactions