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

Comply with expected header for generated Go code #52

Merged
merged 1 commit into from
Jun 1, 2018
Merged

Comply with expected header for generated Go code #52

merged 1 commit into from
Jun 1, 2018

Conversation

mdlayher
Copy link
Contributor

@mdlayher mdlayher commented Jun 1, 2018

Hello! I'm using c-for-go for several projects, and thus far have had to add workarounds to avoid linting code generated by this tool. I just realized that the header generated by the tool doesn't quite comply with the recognized format for generated Go code, as defined in this issue: golang/go#13560.

This resolves that problem and allows linting tools to recognize and skip code generated by this tool.

Before:

✔ ~/src/github.com/mdlayher/devlink [master|…2] 
10:01 $ golint ./...
internal/dlh/const.go:64:2: don't use underscores in Go names; const __CmdMax should be _CmdMax
internal/dlh/const.go:183:2: const AttrDpipeHeaderId should be AttrDpipeHeaderID
internal/dlh/const.go:189:2: const AttrDpipeFieldId should be AttrDpipeFieldID
internal/dlh/const.go:197:2: const AttrResourceId should be AttrResourceID
internal/dlh/const.go:206:2: const AttrDpipeTableResourceId should be AttrDpipeTableResourceID
internal/dlh/const.go:208:2: don't use underscores in Go names; const __AttrMax should be _AttrMax
internal/dlh/const.go:238:6: type devlinkDpipeFieldEthernetId should be devlinkDpipeFieldEthernetID
internal/dlh/const.go:250:2: const DpipeFieldIpv4DstIp should be DpipeFieldIpv4DstIP
internal/dlh/const.go:258:2: const DpipeFieldIpv6DstIp should be DpipeFieldIpv6DstIP
internal/dlh/const.go:262:6: type devlinkDpipeHeaderId should be devlinkDpipeHeaderID

After:

✔ ~/src/github.com/mdlayher/devlink [master|…2]
10:01 $ go generate ./...
--2018-06-01 10:01:11--  https://raw.githubusercontent.com/torvalds/linux/master/include/uapi/linux/devlink.h
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.184.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.184.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8216 (8.0K) [text/plain]
Saving to: ‘devlink.h’

devlink.h                        100%[=========================================================>]   8.02K  --.-KB/s    in 0.001s

2018-06-01 10:01:12 (13.0 MB/s) - ‘devlink.h’ saved [8216/8216]

  processing dlh.yml done.
✔ ~/src/github.com/mdlayher/devlink [master|✚ 1…2]
10:01 $ golint ./...

@xlab
Copy link
Owner

xlab commented Jun 1, 2018

Cool, I'm glad that the changes required to comply are not that harsh as I expected :)

@xlab xlab merged commit 3a95514 into xlab:master Jun 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants