Add common lint target for golang.
makefiles/lint/include.mk
makefiles/lint/golang/include.mk
makefiles/lint/golang/sca.mk
================================
o sca -> static-code-analysis
o Copy in golang lint target from repo:voltha-openolt-adapter.
o Cleanup needed but start with a verbatim import.
Change-Id: I057ee09a740aae855fa25162e55c4dad30365a6b
diff --git a/makefiles/lint/golang/include.mk b/makefiles/lint/golang/include.mk
new file mode 100644
index 0000000..f5f363d
--- /dev/null
+++ b/makefiles/lint/golang/include.mk
@@ -0,0 +1,27 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+#
+# SPDX-FileCopyrightText: 2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+include $(ONF_MAKEDIR)/lint/golang/sca.mk
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/golang/sca.mk b/makefiles/lint/golang/sca.mk
new file mode 100644
index 0000000..f217cde
--- /dev/null
+++ b/makefiles/lint/golang/sca.mk
@@ -0,0 +1,66 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 Open Networking Foundation
+#
+# 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.
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+GOLANG_FILES ?= $(error PYTHON_FILES= is required)
+
+.PHONY: lint-golang-sca
+
+# lint : lint-golang-sca
+
+## -----------------------------------------------------------------------
+## Intent: Run goformat on files on sandbox files.
+## 1) find . -name '*.go' -print0
+## - gather all *.go sources (-name '*.go')
+## - pass as a list of null terminated items (-print0)
+## 2) xargs --null --max-args=[n] --no-run-if-empty gofmt -d
+## - Iterate over the list (xargs --null)
+## - process one item per line (--max-args=1)
+## - display filename-to-check (--verbose)
+## - display content when diffs are detected:
+## gofmt -d
+## gofmt -d -s
+## -----------------------------------------------------------------------
+lint-golang-sca-xargs := $(null)
+lint-golang-sca-xargs += --null#+ # Source paths are null terminated
+lint-golang-sca-xargs += --max-args=1#+ # Check one file at a time
+lint-golang-sca-xargs += --no-run-if-empty
+lint-golang-sca-xargs += --verbose#+ # Display source path to check
+
+## [INPLACE-EDITS] make lint-golang-sca FIX=1
+ifdef FIX
+ lint-golang-sca-args += -w
+endif
+
+lint-golang-sca:
+ find . -name '*.go' -print0 \
+ | xargs $(lint-golang-sca-xargs) gofmt -d -s
+
+help::
+ @echo " lint-golang-sca Syntax check golang sources"
+ @echo " MODIFIER: FIX=1 Correct problems (gofmt -d -s -w)"
+
+todo ::
+ @echo ' Rename sca.mk to source-code-analysis.mk'
+ @echo ' lint-golang-sca is a default lint target for repo:voltha-openolt-adapter'
+ @echo ' Update logic to support common targets lint-*-{all,mod,src}'
+ @echo ' What flag should be used for inplace edits: APPLY=1, FIX=1, UPDATE=1, ??'
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/include.mk b/makefiles/lint/include.mk
index 68f84cc..4edb487 100644
--- a/makefiles/lint/include.mk
+++ b/makefiles/lint/include.mk
@@ -17,9 +17,6 @@
# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
-# https://gerrit.opencord.org/plugins/gitiles/onf-make
-# ONF.makefile.version = 1.2
-# -----------------------------------------------------------------------
$(if $(DEBUG),$(warning ENTER))
@@ -34,6 +31,7 @@
endif
include $(ONF_MAKEDIR)/lint/doc8/include.mk
+include $(ONF_MAKEDIR)/lint/golang/include.mk
include $(ONF_MAKEDIR)/lint/groovy/include.mk
include $(ONF_MAKEDIR)/lint/jjb.mk
include $(ONF_MAKEDIR)/lint/json.mk