Refactoring (#43)
* Cleanup .gitignore * Document minimum server version * Become golint compliant * Use pre defined http method * Update dependencies * Add i18n-extract target * Add golint target * Run check-style against all go files Co-Authored-By: Jesse Hallam <jesse.hallam@gmail.com>
This commit is contained in:
parent
2f14f54b59
commit
43af4d9cfe
12 changed files with 351 additions and 83 deletions
1
server/.gitignore
vendored
1
server/.gitignore
vendored
|
@ -1,2 +1 @@
|
|||
coverage.txt
|
||||
.depensure
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package main
|
||||
|
||||
var manifest = struct {
|
||||
Id string
|
||||
ID string
|
||||
Version string
|
||||
}{
|
||||
Id: "com.mattermost.sample-plugin",
|
||||
ID: "com.mattermost.sample-plugin",
|
||||
Version: "0.1.0",
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"github.com/mattermost/mattermost-server/plugin"
|
||||
)
|
||||
|
||||
// Plugin implements the interface expected by the Mattermost server to communicate between the server and plugin processes.
|
||||
type Plugin struct {
|
||||
plugin.MattermostPlugin
|
||||
|
||||
|
@ -19,8 +20,9 @@ type Plugin struct {
|
|||
configuration *configuration
|
||||
}
|
||||
|
||||
// ServeHTTP demonstrates a plugin that handles HTTP requests by greeting the world.
|
||||
func (p *Plugin) ServeHTTP(c *plugin.Context, w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintf(w, "Hello, world!")
|
||||
fmt.Fprint(w, "Hello, world!")
|
||||
}
|
||||
|
||||
// See https://developers.mattermost.com/extend/plugins/server/reference/
|
||||
|
|
|
@ -2,6 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
|
@ -12,7 +13,7 @@ func TestServeHTTP(t *testing.T) {
|
|||
assert := assert.New(t)
|
||||
plugin := Plugin{}
|
||||
w := httptest.NewRecorder()
|
||||
r := httptest.NewRequest("GET", "/", nil)
|
||||
r := httptest.NewRequest(http.MethodGet, "/", nil)
|
||||
|
||||
plugin.ServeHTTP(nil, w, r)
|
||||
|
||||
|
|
Reference in a new issue