thestrukture/IDE

View on GitHub
api/handlers/rest_POSTApiGovet.go

Summary

Maintainability
A
0 mins
Test Coverage
// File generated by Gopher Sauce
// DO NOT EDIT!!
package handlers

import (
    "net/http"
    "os"
    "os/exec"
    "path/filepath"

    "github.com/gorilla/sessions"
    types "github.com/thestrukture/IDE/types"
)

//
func POSTApiGovet(w http.ResponseWriter, r *http.Request, session *sessions.Session) (response string, callmet bool) {

    pkg := r.FormValue("pkg")
    path := filepath.Join(os.ExpandEnv("$GOPATH"), "src", pkg)

    os.Chdir(path)
    cmd := exec.Command("go", "vet")
    stOut, _ := cmd.CombinedOutput()

    res := types.Dex{Text: string(stOut)}

    response = mResponse(res)

    callmet = true
    return
}