質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Mattermost

Mattermostは、オープンソースで公開されているチャットサービスです。Slackの代替ツールとして提供されており、Slackでの機能はほぼ備わっています。コンプライアンスニーズに対応した設計であることが特徴です。

Go

Go(golang)は、Googleで開発されたオープンソースのプログラミング言語です。

Docker

Dockerは、Docker社が開発したオープンソースのコンテナー管理ソフトウェアの1つです

Q&A

解決済

1回答

3167閲覧

【go言語】MattermostにSkypeをプラグインしたいのですが、makeコマンド実行時のエラーが特定できません。

RMBQsKe5AP10gjx

総合スコア24

Mattermost

Mattermostは、オープンソースで公開されているチャットサービスです。Slackの代替ツールとして提供されており、Slackでの機能はほぼ備わっています。コンプライアンスニーズに対応した設計であることが特徴です。

Go

Go(golang)は、Googleで開発されたオープンソースのプログラミング言語です。

Docker

Dockerは、Docker社が開発したオープンソースのコンテナー管理ソフトウェアの1つです

0グッド

0クリップ

投稿2019/08/03 02:25

編集2019/08/03 02:43

MattermostにSkypeをプラグインしたいのですが、go言語の理解不足で、makeコマンド実行時のエラーが特定できません。
環境はWindows10、
Mattermostのバージョン: 5.13.2
データベーススキーマのバージョン: 5.13.0
データベース: mysql
go言語のバージョンは1.12.7です。

Makefileの内容は以下となります。

GO ?= $(shell command -v go 2> /dev/null) NPM ?= $(shell command -v npm 2> /dev/null) CURL ?= $(shell command -v curl 2> /dev/null) MANIFEST_FILE ?= plugin.json GOPATH ?= $(shell go env GOPATH) GO_TEST_FLAGS ?= -race GO_BUILD_FLAGS ?= MM_UTILITIES_DIR ?= ../mattermost-utilities export GO111MODULE=on # You can include assets this directory into the bundle. This can be e.g. used to include profile pictures. ASSETS_DIR ?= assets # Verify environment, and define PLUGIN_ID, PLUGIN_VERSION, HAS_SERVER and HAS_WEBAPP as needed. include build/setup.mk BUNDLE_NAME ?= $(PLUGIN_ID)-$(PLUGIN_VERSION).tar.gz # Include custom makefile, if pressent ifneq ($(wildcard build/custom.mk),) include build/custom.mk endif ## Checks the code style, tests, builds and bundles the plugin. all: check-style test dist ## Propagates plugin manifest information into the server/ and webapp/ folders as required. .PHONY: apply apply: ./build/bin/manifest apply ## Runs govet and gofmt against all packages. .PHONY: check-style check-style: webapp/.npminstall gofmt govet golint @echo Checking for style guide compliance ifneq ($(HAS_WEBAPP),) cd webapp && npm run lint endif ## Runs gofmt against all packages. .PHONY: gofmt gofmt: ifneq ($(HAS_SERVER),) @echo Running gofmt @for package in $$(go list ./...); do \ echo "Checking "$$package; \ files=$$(go list -f '{{range .GoFiles}}{{$$.Dir}}/{{.}} {{end}}' $$package); \ if [ "$$files" ]; then \ gofmt_output=$$(gofmt -d -s $$files 2>&1); \ if [ "$$gofmt_output" ]; then \ echo "$$gofmt_output"; \ echo "Gofmt failure"; \ exit 1; \ fi; \ fi; \ done @echo Gofmt success endif ## Runs govet against all packages. .PHONY: govet govet: ifneq ($(HAS_SERVER),) @echo Running govet @# Workaround because you can't install binaries without adding them to go.mod env GO111MODULE=off $(GO) get golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow $(GO) vet ./... $(GO) vet -vettool=$(GOPATH)/bin/shadow ./... @echo Govet success endif ## Runs golint against all packages. .PHONY: golint golint: @echo Running lint env GO111MODULE=off $(GO) get golang.org/x/lint/golint $(GOPATH)/bin/golint -set_exit_status ./... @echo lint success ## Builds the server, if it exists, including support for multiple architectures. .PHONY: server server: ifneq ($(HAS_SERVER),) mkdir -p server/dist; cd server && env GOOS=linux GOARCH=amd64 $(GO) build $(GO_BUILD_FLAGS) -o dist/plugin-linux-amd64; cd server && env GOOS=darwin GOARCH=amd64 $(GO) build $(GO_BUILD_FLAGS) -o dist/plugin-darwin-amd64; cd server && env GOOS=windows GOARCH=amd64 $(GO) build $(GO_BUILD_FLAGS) -o dist/plugin-windows-amd64.exe; endif ## Ensures NPM dependencies are installed without having to run this all the time. webapp/.npminstall: ifneq ($(HAS_WEBAPP),) cd webapp && $(NPM) install touch $@ endif ## Builds the webapp, if it exists. .PHONY: webapp webapp: webapp/.npminstall ifneq ($(HAS_WEBAPP),) cd webapp && $(NPM) run build; endif ## Generates a tar bundle of the plugin for install. .PHONY: bundle bundle: rm -rf dist/ mkdir -p dist/$(PLUGIN_ID) cp $(MANIFEST_FILE) dist/$(PLUGIN_ID)/ ifneq ($(wildcard $(ASSETS_DIR)/.),) cp -r $(ASSETS_DIR) dist/$(PLUGIN_ID)/ endif ifneq ($(HAS_PUBLIC),) cp -r public/ dist/$(PLUGIN_ID)/ endif ifneq ($(HAS_SERVER),) mkdir -p dist/$(PLUGIN_ID)/server/dist; cp -r server/dist/* dist/$(PLUGIN_ID)/server/dist/; endif ifneq ($(HAS_WEBAPP),) mkdir -p dist/$(PLUGIN_ID)/webapp/dist; cp -r webapp/dist/* dist/$(PLUGIN_ID)/webapp/dist/; endif cd dist && tar -cvzf $(BUNDLE_NAME) $(PLUGIN_ID) @echo plugin built at: dist/$(BUNDLE_NAME) ## Builds and bundles the plugin. .PHONY: dist dist: apply server webapp bundle ## Installs the plugin to a (development) server. .PHONY: deploy deploy: dist ## It uses the API if appropriate environment variables are defined, ## or copying the files directly to a sibling mattermost-server directory. ifneq ($(and $(MM_SERVICESETTINGS_SITEURL),$(MM_ADMIN_USERNAME),$(MM_ADMIN_PASSWORD),$(CURL)),) @echo "Installing plugin via API" $(eval TOKEN := $(shell curl -i --post301 --location $(MM_SERVICESETTINGS_SITEURL) -X POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/users/login -d '{"login_id": "$(MM_ADMIN_USERNAME)", "password": "$(MM_ADMIN_PASSWORD)"}' | grep Token | cut -f2 -d' ' 2> /dev/null)) @curl -s --post301 --location $(MM_SERVICESETTINGS_SITEURL) -H "Authorization: Bearer $(TOKEN)" -X POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/plugins -F "plugin=@dist/$(BUNDLE_NAME)" -F "force=true" > /dev/null && \ curl -s --post301 --location $(MM_SERVICESETTINGS_SITEURL) -H "Authorization: Bearer $(TOKEN)" -X POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/plugins/$(PLUGIN_ID)/enable > /dev/null && \ echo "OK." || echo "Sorry, something went wrong." else ifneq ($(wildcard ../mattermost-server/.*),) @echo "Installing plugin via filesystem. Server restart and manual plugin enabling required" mkdir -p ../mattermost-server/plugins tar -C ../mattermost-server/plugins -zxvf dist/$(BUNDLE_NAME) else @echo "No supported deployment method available. Install plugin manually." endif ## Runs any lints and unit tests defined for the server and webapp, if they exist. .PHONY: test test: webapp/.npminstall ifneq ($(HAS_SERVER),) $(GO) test -v $(GO_TEST_FLAGS) ./server/... endif ifneq ($(HAS_WEBAPP),) cd webapp && $(NPM) run fix #No tests yet && $(NPM) run test; endif ## Creates a coverage report for the server code. .PHONY: coverage coverage: webapp/.npminstall ifneq ($(HAS_SERVER),) $(GO) test $(GO_TEST_FLAGS) -coverprofile=server/coverage.txt ./server/... $(GO) tool cover -html=server/coverage.txt endif ## Extract strings for translation from the source code. .PHONY: i18n-extract i18n-extract: ifneq ($(HAS_WEBAPP),) ifeq ($(HAS_MM_UTILITIES),) @echo "You must clone github.com/mattermost/mattermost-utilities repo in .. to use this command" else cd $(MM_UTILITIES_DIR) && npm install && npm run babel && node mmjstool/build/index.js i18n extract-webapp --webapp-dir $(PWD)/webapp endif endif ## Clean removes all build artifacts. .PHONY: clean clean: rm -fr dist/ ifneq ($(HAS_SERVER),) rm -fr server/dist endif ifneq ($(HAS_WEBAPP),) rm -fr webapp/.npminstall rm -fr webapp/dist rm -fr webapp/node_modules endif rm -fr build/bin/ # Help documentatin à la https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html help: @cat Makefile | grep -v '.PHONY' | grep -v '\help:' | grep -B1 -E '^[a-zA-Z0-9_.-]+:.*' | sed -e "s/:.*//" | sed -e "s/^## //" | grep -v '\-\-' | sed '1!G;h;$$!d' | awk 'NR%2{printf "\033[36m%-30s\033[0m",$$0;next;}1' | sort

エラーの内容は以下です。

touch webapp/.npminstall Running gofmt Checking github.com/mattermost/mattermost-plugin-skype4business/build/manifest Checking github.com/mattermost/mattermost-plugin-skype4business/server Gofmt success Running govet env GO111MODULE=off /usr/local/go/bin/go get golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow /usr/local/go/bin/go vet ./... /usr/local/go/bin/go vet -vettool=/root/Projects/Proj1/bin/shadow ./... # github.com/mattermost/mattermost-plugin-skype4business/server server/plugin.go:309:5: declaration of "post" shadows declaration at line 292 server/plugin.go:404:5: declaration of "post" shadows declaration at line 387 Makefile:66: recipe for target 'govet' failed make: *** [govet] Error 2

plugin.goの該当部分は以下です。

309

1 if post, err := p.API.CreatePost(post); err != nil { 2 fmt.Println(err.Error()) 3 http.Error(w, err.Error(), err.StatusCode) 4 return 5 } else { 6 err = p.API.KVSet(fmt.Sprintf("%v%v", POST_MEETING_KEY, req.MeetingId), []byte(post.Id)) 7 if err != nil { 8 fmt.Println(err.Error()) 9 http.Error(w, err.Error(), err.StatusCode) 10 return 11 } 12 }

404

1 if post, err := p.API.CreatePost(post); err != nil { 2 mlog.Error("Error creating a new post with the new meeting: " + err.Error()) 3 http.Error(w, err.Error(), http.StatusInternalServerError) 4 return 5 } else { 6 err = p.API.KVSet(fmt.Sprintf("%v%v", POST_MEETING_KEY, newMeetingResponse.MeetingId), []byte(post.Id)) 7 if err != nil { 8 mlog.Error("Error writing meeting id to the database: " + err.Error()) 9 http.Error(w, err.Error(), http.StatusInternalServerError) 10 return 11 } 12 }

不足情報があればご教示願います。
よろしくお願いいたします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

make distで実行できました。

投稿2019/08/04 07:20

RMBQsKe5AP10gjx

総合スコア24

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問