thestrukture/IDE

View on GitHub
api/methods/method_PluginJS.go

Summary

Maintainability
A
0 mins
Test Coverage
F
50%
// File generated by Gopher Sauce
// DO NOT EDIT!!
package methods

import (
    "fmt"
    "io/ioutil"
    "os"
)

//
func PluginJS(args ...interface{}) string {

    plugins := GetPlugins()
    jsstring := ""
    for _, v := range plugins {
        data, err := ioutil.ReadFile(os.ExpandEnv("$GOPATH") + "/src/" + v + "/index.js")
        if err != nil {
            fmt.Println("Error loading ", v)
        } else {
            jsstring = jsstring + "\n" + string(data)
        }
    }
    return "<script>" + jsstring + "</script>"

}