thestrukture/IDE

View on GitHub
api/handlers/rest_POSTApiGolint.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 POSTApiGolint(w http.ResponseWriter, r *http.Request, session *sessions.Session) (response string, callmet bool) {

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

    cmd := exec.Command("golint", path)
    stOut, _ := cmd.CombinedOutput()

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

    response = mResponse(res)

    callmet = true
    return
}