Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- lastfile=""
- cnt=0
- golint ./... | egrep ' exported (function|method|type) ' | while read line; do
- echo "-> "$line
- file=`echo $line | cut -d: -f1`
- if [ "$file" = "$lastfile" ]; then
- cnt=$((cnt+1))
- else
- cnt=0
- fi
- lineno=`echo $line | cut -d: -f2`
- lineno=$((lineno + cnt))
- if [[ $line =~ ": exported type" ]]; then
- func=`echo $line | cut -d' ' -f4`
- gsed -i -e "${lineno}i //${func} ..." $file
- echo "update"
- elif [[ $line =~ ": exported function" ]]; then
- func=`echo $line | cut -d' ' -f4`
- gsed -i -e "${lineno}i //${func} ..." $file
- echo "update"
- elif [[ $line =~ ": comment on exported function" ]]; then
- func=`echo $line | cut -d' ' -f6`
- gsed -i -e "${lineno}i //${func} ..." $file
- echo "update"
- elif [[ $line =~ ": exported method" ]]; then
- pkg=`echo $line | cut -d' ' -f4`
- method=`echo $pkg | cut -d. -f2`
- gsed -i -e "${lineno}i //${method} ..." $file
- echo "update"
- else
- cnt=$((cnt-1))
- fi
- lastfile=$file
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement