Skip to content

Commit d0fac45

Browse files
committed
hack: fix godep license parsing for gopkg.in packages
The script incorrectly thinks that `gopkg.in/square/go-jose.v2/cipher` doesn't have a license because it parses `gopkg.in/square` as the root of the repo, even though `gopkg.in/square/go-jose.v2` is the root. Add special handling for gopkg.in packages by grep'ing for the version that gopkg.in appends to the package name.
1 parent 6b1b6d5 commit d0fac45

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

hack/update-godep-licenses.sh

+8
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ process_content () {
7575
go4.org/*)
7676
package_root=$(echo ${package} |awk -F/ '{ print $1 }')
7777
;;
78+
gopkg.in/*)
79+
# Root of gopkg.in package always ends with '.v(number)' and my contain
80+
# more than two path elements. For example:
81+
# - gopkg.in/yaml.v2
82+
# - gopkg.in/inf.v0
83+
# - gopkg.in/square/go-jose.v2
84+
package_root=$(echo ${package} |grep -oh '.*\.v[0-9]')
85+
;;
7886
*)
7987
package_root=$(echo ${package} |awk -F/ '{ print $1"/"$2 }')
8088
;;

0 commit comments

Comments
 (0)