Skip to content

Commit

Permalink
feat: add script to automate license header insertion
Browse files Browse the repository at this point in the history
Add `boilerplate.sh` script that automatically prepends license headers
to Go files that don't already have them.
  • Loading branch information
a-hilaly committed Nov 9, 2024
1 parent b9ab30f commit 8bcb823
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
8 changes: 8 additions & 0 deletions hack/boilerplate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -e

for i in $(find ./cmd ./internal ./test ./hack -name "*.go"); do
if ! grep -q "Apache License" "$i"; then
printf '%s\n%s\n' "$(cat hack/boilerplate.go.txt)" "$(cat $i)" > temp && mv temp "$i"
fi
done
12 changes: 12 additions & 0 deletions internal/controller/resourcegroup/errors/resourcegroup.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"). You may
// not use this file except in compliance with the License. A copy of the
// License is located at
//
// http://aws.amazon.com/apache2.0/
//
// or in the "license" file accompanying this file. This file is distributed
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
// express or implied. See the License for the specific language governing
// permissions and limitations under the License.
package errors

import "fmt"
Expand Down
12 changes: 12 additions & 0 deletions internal/dynamiccontroller/dynamic_controller_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"). You may
// not use this file except in compliance with the License. A copy of the
// License is located at
//
// http://aws.amazon.com/apache2.0/
//
// or in the "license" file accompanying this file. This file is distributed
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
// express or implied. See the License for the specific language governing
// permissions and limitations under the License.
package dynamiccontroller

import (
Expand Down
12 changes: 12 additions & 0 deletions internal/graph/schema/schema.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"). You may
// not use this file except in compliance with the License. A copy of the
// License is located at
//
// http://aws.amazon.com/apache2.0/
//
// or in the "license" file accompanying this file. This file is distributed
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
// express or implied. See the License for the specific language governing
// permissions and limitations under the License.
package schema

import (
Expand Down

0 comments on commit 8bcb823

Please sign in to comment.