V
V
v- death2015-10-17 20:45:48
go
v- death, 2015-10-17 20:45:48

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 api/method/dev/dev.go
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);
    }
}

api/kernel/dbstruct
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

Thanks to all.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
v- deathi, 2015-10-17
@vGrabko99

There were two dev.gos in the methods folder, one in the root and one in the dev folder. Accidentally noticed. Tricky bugs have begun))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question