Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go Code format checker and formatter #112

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion cvl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ SRC_FILES=$(shell find . -name '*.go' | grep -v '_test.go' | grep -v '/tests/')
TEST_FILES=$(wildcard *_test.go)
TOP_DIR := ..
BUILD_DIR:=$(TOP_DIR)/build/cvl
FORMAT_CHECK = $(BUILD_DIR)/.formatcheck

CVL_SCHEMA_DIR = $(BUILD_DIR)/schema
CVL_SCHEMA = $(CVL_SCHEMA_DIR)/.done
Expand All @@ -36,7 +37,7 @@ CVL_TEST_SCHEMA = $(CVL_TEST_SCHEMA_DIR)/.done
CVL_TEST_YANGS = $(wildcard testdata/schema/*.yang)
CVL_TEST_YANGS += $(wildcard $(YANG_SRC_DIR)/sonic/common/*.yang)

DEFAULT_TARGETS = $(CVL_SCHEMA)
DEFAULT_TARGETS = $(CVL_SCHEMA) $(FORMAT_CHECK)
ifeq ($(NO_TEST_BINS),)
DEFAULT_TARGETS += $(CVL_TEST_BIN)
endif
Expand Down Expand Up @@ -79,6 +80,12 @@ gotest: $(CVL_TEST_SCHEMA)
CVL_SCHEMA_PATH=$(abspath $(CVL_TEST_SCHEMA_DIR)) \
tests/run_test.sh

$(FORMAT_CHECK): $(SRC_FILES) $(TEST_FILES) | $$(@D)/.
$(TOP_DIR)/tools/test/format-check.sh \
--log=$(@D)/formatcheck.log \
$?
touch $@

clean:
$(RM) -r $(CVL_TEST_DIR) $(BUILD_DIR)

Expand Down
8 changes: 4 additions & 4 deletions cvl/custom_validation/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ const (

// CVLEditConfigData Strcture for key and data in API
type CVLEditConfigData struct {
VType CVLValidateType //Validation type
VOp CVLOperation //Operation type
Key string //Key format : "PORT|Ethernet4"
Data map[string]string //Value : {"alias": "40GE0/28", "mtu" : 9100, "admin_status": down}
VType CVLValidateType //Validation type
VOp CVLOperation //Operation type
Key string //Key format : "PORT|Ethernet4"
Data map[string]string //Value : {"alias": "40GE0/28", "mtu" : 9100, "admin_status": down}
}

// CVLErrorInfo CVL Error Structure
Expand Down
Loading