From 9534e89c796edb8b7c0e8197c7e4ddca149d9526 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Wed, 29 Jul 2020 12:53:57 +0200 Subject: [PATCH] all: mark auto-generated files Use the standard Go convention for Go files: https://golang.org/pkg/cmd/go/internal/generate Use github linguish for other files: https://github.com/github/linguist#generated-code Both are understood by github and should result in these files being collapsed in PRs by default. --- .gitattributes | 1 + pkg/build/linux.go | 2 +- pkg/build/linux_generated.go | 2 +- pkg/csource/gen.go | 2 +- pkg/csource/generated.go | 2 +- pkg/html/generated.go | 1 + pkg/html/html.go | 4 ++-- pkg/ifuzz/gen/gen.go | 2 +- pkg/ifuzz/generated/insns.go | 2 +- 9 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..39fac4cb --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +executor/kvm.S.h linguist-generated diff --git a/pkg/build/linux.go b/pkg/build/linux.go index a5f74db4..6907310d 100644 --- a/pkg/build/linux.go +++ b/pkg/build/linux.go @@ -1,7 +1,7 @@ // Copyright 2017 syzkaller project authors. All rights reserved. // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. -//go:generate bash -c "echo -en '// AUTOGENERATED FILE\n\n' > linux_generated.go" +//go:generate bash -c "echo -en '// Code generated by pkg/build/linux.go. DO NOT EDIT.\n\n' > linux_generated.go" //go:generate bash -c "echo -en 'package build\n\n' >> linux_generated.go" //go:generate bash -c "echo -en 'const createImageScript = `#!/bin/bash\n' >> linux_generated.go" //go:generate bash -c "cat ../../tools/create-gce-image.sh | grep -v '#' >> linux_generated.go" diff --git a/pkg/build/linux_generated.go b/pkg/build/linux_generated.go index 57361fd3..fb426e60 100644 --- a/pkg/build/linux_generated.go +++ b/pkg/build/linux_generated.go @@ -1,4 +1,4 @@ -// AUTOGENERATED FILE +// Code generated by pkg/build/linux.go. DO NOT EDIT. package build diff --git a/pkg/csource/gen.go b/pkg/csource/gen.go index cc96d60c..efdf6bb8 100644 --- a/pkg/csource/gen.go +++ b/pkg/csource/gen.go @@ -53,7 +53,7 @@ func main() { } { data = regexp.MustCompile(remove).ReplaceAll(data, nil) } - fmt.Fprintf(out, "// AUTOGENERATED FILE FROM executor/*.h\n\n") + fmt.Fprintf(out, "// Code generated by gen.go from executor/*.h. DO NOT EDIT.\n\n") fmt.Fprintf(out, "package csource\n\nvar commonHeader = `\n") out.Write(data) fmt.Fprintf(out, "`\n") diff --git a/pkg/csource/generated.go b/pkg/csource/generated.go index b8fad4fb..3c25c257 100644 --- a/pkg/csource/generated.go +++ b/pkg/csource/generated.go @@ -1,4 +1,4 @@ -// AUTOGENERATED FILE FROM executor/*.h +// Code generated by gen.go from executor/*.h. DO NOT EDIT. package csource diff --git a/pkg/html/generated.go b/pkg/html/generated.go index 9ded079b..9d85807d 100644 --- a/pkg/html/generated.go +++ b/pkg/html/generated.go @@ -1,3 +1,4 @@ +// Code generated by pkg/html/html.go. DO NOT EDIT. package html const style = ` diff --git a/pkg/html/html.go b/pkg/html/html.go index 4bd9621d..55df6d97 100644 --- a/pkg/html/html.go +++ b/pkg/html/html.go @@ -1,8 +1,8 @@ // Copyright 2018 syzkaller project authors. All rights reserved. // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. -//go:generate bash -c "echo '// AUTOGENERATED FILE' > generated.go" -//go:generate bash -c "echo 'package html' > generated.go" +//go:generate bash -c "echo '// Code generated by pkg/html/html.go. DO NOT EDIT.' > generated.go" +//go:generate bash -c "echo 'package html' >> generated.go" //go:generate bash -c "echo 'const style = `' >> generated.go" //go:generate bash -c "cat ../../dashboard/app/static/style.css >> generated.go" //go:generate bash -c "echo '`' >> generated.go" diff --git a/pkg/ifuzz/gen/gen.go b/pkg/ifuzz/gen/gen.go index 2bbd6910..654a3cf1 100644 --- a/pkg/ifuzz/gen/gen.go +++ b/pkg/ifuzz/gen/gen.go @@ -163,7 +163,7 @@ nextInsn: fmt.Fprintf(os.Stderr, "deduped %v instructions\n", len(insns)-len(deduped)) insns = deduped - fmt.Printf("// AUTOGENERATED FILE\n\n") + fmt.Printf("// Code generated by pkg/ifuzz/gen. DO NOT EDIT.\n\n") fmt.Printf("// +build !codeanalysis\n\n") fmt.Printf("package generated\n\n") fmt.Printf("import . \"github.com/google/syzkaller/pkg/ifuzz\"\n\n") diff --git a/pkg/ifuzz/generated/insns.go b/pkg/ifuzz/generated/insns.go index f63233a9..3a2f747f 100644 --- a/pkg/ifuzz/generated/insns.go +++ b/pkg/ifuzz/generated/insns.go @@ -1,4 +1,4 @@ -// AUTOGENERATED FILE +// Code generated by pkg/ifuzz/gen. DO NOT EDIT. // +build !codeanalysis