Fix gofmt and go vet errors.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..e240d1f
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,8 @@
+all:
+ bazel build ...
+
+test:
+ bazel test ... --test_output=all
+
+checkfmt:
+ (cd adapter; ../tools/checkfmt.sh)
diff --git a/adapter/apigee.go b/adapter/apigee.go
index cddcfb1..985e1bf 100644
--- a/adapter/apigee.go
+++ b/adapter/apigee.go
@@ -1,16 +1,18 @@
-// Copyright 2017 Istio Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License 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.
+/*
+Copyright 2017 The apid Authors
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License 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 apigee
diff --git a/adapter/apigeeKeyChecker.go b/adapter/apigeeKeyChecker.go
index 3aeeaf8..69b6476 100644
--- a/adapter/apigeeKeyChecker.go
+++ b/adapter/apigeeKeyChecker.go
@@ -1,16 +1,18 @@
-// Copyright 2017 Istio Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License 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.
+/*
+Copyright 2017 The apid Authors
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License 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 apigee
diff --git a/adapter/apigeeKeyChecker_test.go b/adapter/apigeeKeyChecker_test.go
index b4a2f26..61a11e0 100644
--- a/adapter/apigeeKeyChecker_test.go
+++ b/adapter/apigeeKeyChecker_test.go
@@ -1,2 +1,17 @@
-package apigee
+/*
+Copyright 2017 The apid Authors
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License 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 apigee
diff --git a/adapter/apigeeReport.go b/adapter/apigeeReport.go
index 7caa87c..861dda7 100644
--- a/adapter/apigeeReport.go
+++ b/adapter/apigeeReport.go
@@ -1,3 +1,19 @@
+/*
+Copyright 2017 The apid Authors
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License 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 apigee
import (
@@ -26,7 +42,7 @@
RequestUri string `json:"request_uri"`
RequestPath string `json:"request_path"`
RequestVerb string `json:"request_verb"`
- ClientIp string `json:"request_path"`
+ ClientIp string `json:"client_ip"`
UserAgent string `json:"useragent"`
ApiProxyRevision string `json:"apiproxy_revision"`
ResponseStatusCode int `json:"response_status_code"`
diff --git a/tools/checkfmt.sh b/tools/checkfmt.sh
new file mode 100755
index 0000000..68db939
--- /dev/null
+++ b/tools/checkfmt.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+failed=0
+
+lc=`ls *.go 2>/dev/null | wc -l`
+if [ $lc -gt 0 ]
+then
+ lc=`goimports -l . | wc -l`
+ if [ $lc -gt 0 ]
+ then
+ echo "** goimports run required:"
+ gofmt -l .
+ failed=1
+ fi
+
+ go vet
+ if [ $? -ne 0 ]
+ then
+ echo "** go vet failed"
+ failed=1
+ fi
+fi
+
+shopt -s nullglob
+for f in *.go *.[ch]
+do
+ lc=`egrep -c 'Copyright [0-9]+ The apid Authors|Apache License' $f`
+ if [ $lc -lt 2 ]
+ then
+ echo "** $f is missing a license header"
+ failed=1
+ fi
+done
+shopt -u nullglob
+
+if [ $failed -gt 0 ]
+then
+ exit 2
+fi
+