Git Product home page Git Product logo

Comments (10)

vaind avatar vaind commented on May 20, 2024 1

OK so there was a misunderstanding. Cross compilation is not supported yet, we'll have a look what would be necessary to make it work.

from objectbox-go.

vaind avatar vaind commented on May 20, 2024 1

Closing in favour of #18 for the followup task (cross compilation support)

from objectbox-go.

vaind avatar vaind commented on May 20, 2024

You're trying to import github.com/objectbox/objectbox-go/internal/generator which is an internal package. Go tool doesn't allow you to do that. What are you trying to achieve? What code is importing this package?

from objectbox-go.

sasa-nori avatar sasa-nori commented on May 20, 2024

I did it

$ GOOS=linux GOARCH=amd64 go build objectbox/shikure.go 
../../../../pkg/mod/github.com/objectbox/[email protected]/objectbox/model.go:30:2: cannot find package

shikure.go is

package objectbox

import (
	"log"
	"net/http"
	"strconv"
	"time"

	"github.com/labstack/echo"
	"github.com/noriyuki-sasagawa/go_api/model"

	"github.com/objectbox/objectbox-go/objectbox"
)

// GetShikureAll シクレ一覧取得
func GetShikureAll(c echo.Context) error {
	// テーブル呼び出し
	box := getBox()

	var list []*model.Shikure
	list, err := box.GetAll()
	if err != nil {
		return err
	}

	return c.JSON(http.StatusOK, list)
}

// AddShikure シクレ追加
func AddShikure(body string, version string) {
	// テーブル呼び出し
	box := getBox()

	const dateLayout = "2006-01-02"
	// データ追加
	time.LoadLocation("Asia/Tokyo")
	versionInt, _ := strconv.Atoi(version)
	id, error := box.Put(&model.Shikure{
		Content: body,
		Hour:    time.Now().Hour(),
		Version: versionInt,
	})
	if error != nil {
		log.Fatalln(error)
		return
	}

	// 追加したデータを取得
	_, error = box.Get(id)
	if error != nil {
		log.Fatalln(error)
	}
}

// RemoveAllShikure シクレ情報全削除
func RemoveAllShikure() {
	// テーブル呼び出し
	box := getBox()
	box.RemoveAll()
}

func getBox() *model.ShikureBox {
	return model.BoxForShikure(initObjectBox())
}

func initObjectBox() *objectbox.ObjectBox {
	objectBox, _ := objectbox.NewBuilder().Model(model.ObjectBoxModel()).Build()
	return objectBox
}

from objectbox-go.

vaind avatar vaind commented on May 20, 2024

shikure.go is
package objectbox

^ this - your package is most certainly not supposed to be called objectbox but rather something related to your project

from objectbox-go.

sasa-nori avatar sasa-nori commented on May 20, 2024

I installed it on Linux instead of Mac and built it.
Probably can't Cross Compile when installed on Mac?

from objectbox-go.

vaind avatar vaind commented on May 20, 2024

I installed it on Linux instead of Mac and built it.
Probably can't Cross Compile when installed on Mac?

Is this still related to the issue above? We're testing on mac and it works fine. Could you provide more details?

from objectbox-go.

sasa-nori avatar sasa-nori commented on May 20, 2024

What I wanted to do was compile for Linux on the Mac.
However, Mac had an error, so it was solved by compiling on Linux.
The problem still remains.

from objectbox-go.

vaind avatar vaind commented on May 20, 2024

I don't understand how those are related then, sorry.

Is your source publicly accessible? From what I've seen above, you're using an incorrect package name in shikure.go - you're using objectbox. I assume it's the name of the directory where this file is located - so your project looks sth. like: ..../objectbox/shikure.go. If that's right, it's not going to work - this is not related to ObjectBox but rather to how Go packages work. To resolve, you need to rename the directory (and update the package objectbox declaration in its files accordingly) to another name.

from objectbox-go.

sasa-nori avatar sasa-nori commented on May 20, 2024

Ah ~
First of all, it can be compiled on Mac and it can be compiled on Linux, so it is not a package issue.

Trying to compile for Linux on a Mac fails.
that's all.

So I thought that if I installed with shell, only Mac libraries would be installed on Mac.

It's a shame that you can't cross compile.

from objectbox-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.