Adding gofmt to travis build
Этот коммит содержится в:
18
Makefile
18
Makefile
@@ -39,6 +39,15 @@ travis:
|
|||||||
|
|
||||||
@echo Checking for style guide compliance
|
@echo Checking for style guide compliance
|
||||||
cd web/react && $(ESLINT) --quiet components/* dispatcher/* pages/* stores/* utils/*
|
cd web/react && $(ESLINT) --quiet components/* dispatcher/* pages/* stores/* utils/*
|
||||||
|
@echo Running gofmt
|
||||||
|
$(eval GOFMT_OUTPUT := $(shell gofmt -d -s api/ model/ store/ utils/ manualtesting/ mattermost.go 2>&1))
|
||||||
|
@echo "$(GOFMT_OUTPUT)"
|
||||||
|
@if [ ! "$(GOFMT_OUTPUT)" ]; then \
|
||||||
|
echo "gofmt sucess"; \
|
||||||
|
else \
|
||||||
|
echo "gofmt failure"; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
@$(GO) build $(GOFLAGS) ./...
|
@$(GO) build $(GOFLAGS) ./...
|
||||||
@$(GO) install $(GOFLAGS) ./...
|
@$(GO) install $(GOFLAGS) ./...
|
||||||
@@ -108,6 +117,15 @@ install:
|
|||||||
check: install
|
check: install
|
||||||
@echo Running ESLint...
|
@echo Running ESLint...
|
||||||
-cd web/react && $(ESLINT) components/* dispatcher/* pages/* stores/* utils/*
|
-cd web/react && $(ESLINT) components/* dispatcher/* pages/* stores/* utils/*
|
||||||
|
@echo Running gofmt
|
||||||
|
$(eval GOFMT_OUTPUT := $(shell gofmt -d -s api/ model/ store/ utils/ manualtesting/ mattermost.go 2>&1))
|
||||||
|
@echo "$(GOFMT_OUTPUT)"
|
||||||
|
@if [[ ! "$(GOFMT_OUTPUT)" ]]; then \
|
||||||
|
echo "gofmt sucess"; \
|
||||||
|
else \
|
||||||
|
echo "gofmt failure"; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
test: install
|
test: install
|
||||||
@mkdir -p logs
|
@mkdir -p logs
|
||||||
|
|||||||
@@ -439,10 +439,10 @@ func IsBetaDomain(r *http.Request) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var privateIpAddress = []*net.IPNet{
|
var privateIpAddress = []*net.IPNet{
|
||||||
&net.IPNet{IP: net.IPv4(10, 0, 0, 1), Mask: net.IPv4Mask(255, 0, 0, 0)},
|
{IP: net.IPv4(10, 0, 0, 1), Mask: net.IPv4Mask(255, 0, 0, 0)},
|
||||||
&net.IPNet{IP: net.IPv4(176, 16, 0, 1), Mask: net.IPv4Mask(255, 255, 0, 0)},
|
{IP: net.IPv4(176, 16, 0, 1), Mask: net.IPv4Mask(255, 255, 0, 0)},
|
||||||
&net.IPNet{IP: net.IPv4(192, 168, 0, 1), Mask: net.IPv4Mask(255, 255, 255, 0)},
|
{IP: net.IPv4(192, 168, 0, 1), Mask: net.IPv4Mask(255, 255, 255, 0)},
|
||||||
&net.IPNet{IP: net.IPv4(127, 0, 0, 1), Mask: net.IPv4Mask(255, 255, 255, 252)},
|
{IP: net.IPv4(127, 0, 0, 1), Mask: net.IPv4Mask(255, 255, 255, 252)},
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsPrivateIpAddress(ipAddress string) bool {
|
func IsPrivateIpAddress(ipAddress string) bool {
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ func uploadFile(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, _ := range files {
|
for i := range files {
|
||||||
file, err := files[i].Open()
|
file, err := files[i].Open()
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -353,7 +353,7 @@ func fireAndForgetNotifications(post *model.Post, teamId, siteURL string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for id, _ := range toEmailMap {
|
for id := range toEmailMap {
|
||||||
fireAndForgetMentionUpdate(post.ChannelId, id)
|
fireAndForgetMentionUpdate(post.ChannelId, id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ type ChannelCounts struct {
|
|||||||
func (o *ChannelCounts) Etag() string {
|
func (o *ChannelCounts) Etag() string {
|
||||||
|
|
||||||
ids := []string{}
|
ids := []string{}
|
||||||
for id, _ := range o.Counts {
|
for id := range o.Counts {
|
||||||
ids = append(ids, id)
|
ids = append(ids, id)
|
||||||
}
|
}
|
||||||
sort.Strings(ids)
|
sort.Strings(ids)
|
||||||
|
|||||||
@@ -440,7 +440,7 @@ func (s SqlChannelStore) GetExtraMembers(channelId string, limit int) StoreChann
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
result.Err = model.NewAppError("SqlChannelStore.GetExtraMembers", "We couldn't get the extra info for channel members", "channel_id="+channelId+", "+err.Error())
|
result.Err = model.NewAppError("SqlChannelStore.GetExtraMembers", "We couldn't get the extra info for channel members", "channel_id="+channelId+", "+err.Error())
|
||||||
} else {
|
} else {
|
||||||
for i, _ := range members {
|
for i := range members {
|
||||||
members[i].Sanitize(utils.SanitizeOptions)
|
members[i].Sanitize(utils.SanitizeOptions)
|
||||||
}
|
}
|
||||||
result.Data = members
|
result.Data = members
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user