Skip to content

Commit 7e93843

Browse files
committed
scripts: add prependlicense.sh, use with go generate
1 parent 8ac3e02 commit 7e93843

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

domain.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package qemu
1717

1818
//go:generate stringer -type=Status -output=string.gen.go
19+
//go:generate ./scripts/prependlicense.sh string.gen.go
1920

2021
import (
2122
"encoding/json"

scripts/prependlicense.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
# License block to be prepended to file
4+
read -r -d '' LICENSE <<EndOfLicense
5+
// Copyright 2016 The go-qemu Authors.
6+
//
7+
// Licensed under the Apache License, Version 2.0 (the "License");
8+
// you may not use this file except in compliance with the License.
9+
// You may obtain a copy of the License at
10+
//
11+
// http://www.apache.org/licenses/LICENSE-2.0
12+
//
13+
// Unless required by applicable law or agreed to in writing, software
14+
// distributed under the License is distributed on an "AS IS" BASIS,
15+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
// See the License for the specific language governing permissions and
17+
// limitations under the License.
18+
EndOfLicense
19+
20+
if [ -z "$1" ]; then
21+
echo "missing filename argument"
22+
echo "usage: prependlicense.sh [filename]"
23+
exit 1
24+
fi
25+
26+
# Prepend license block to file
27+
echo -e "$LICENSE\n" | cat - $1 > .prependlicense && mv .prependlicense $1

string.gen.go

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)