Answer the question
In order to leave comments, you need to log in
Why no buildable Go source?
main.go package
package main
import (
"github.com/julienschmidt/httprouter"
"net/http"
"log"
"api/method/dev"
)
func main() {
router := httprouter.New()
router.GET("/dev.allMethods",dev.AllMethods)
log.Fatal(http.ListenAndServe(":5000", router))
}
package dev
import (
"fmt"
"github.com/julienschmidt/httprouter"
"net/http"
"database/sql"
_ "github.com/go-sql-driver/mysql"
"api/kernel/dbstruct"
)
func AllMethods(w http.ResponseWriter, r *http.Request, ps httprouter.Params){
db, err := sql.Open("mysql", "root:[email protected]/db1")
if err != nil{
fmt.Fprintf(w,"%s",err);
}
rows, err := db.Query("SELECT * FROM method_menu")
if err != nil {
fmt.Fprintf(w,"%s",err);
}
defer rows.Close()
bks := make([]*dbstruct.Dev_menu, 0)
for rows.Next() {
bk := new(dbstruct.Dev_menu)
err := rows.Scan(&bk.id, &bk.name)
if err != nil {
fmt.Fprintf(w,"%s",err);
}
bks = append(bks, bk)
}
if err = rows.Err(); err != nil {
fmt.Fprintf(w,"%s",err);
}
for _, bk := range bks {
fmt.Fprintf(w,"%s....%s", bk.id, bk.name);
}
}
package dbstruct
type DevMenu struct {
id string
name string
}
type DevMethod struct {
id string
id_menu string
name string
description string
}
type DevAccess struct {
id string
name string
}
type DevApp struct {
id string
auth string
access string
name string
description string
}
type Users struct {
id string
activation_email string
login string
email string
pass string
date_reg string
}
type UsersActivationEmail struct{
uid string
code string
}
type AuthTemporaryKey struct {
id string
uid string
app_id string
temporary_key string
}
type AuthAccessToken struct {
id string
uid string
app_id string
token string
}
go run main.go
method/dev/dev.go:10:5: no buildable Go source files in /home/v-smerti/localhost/api/src/api/kernel
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question