Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version.LessThan() function not working properly #48

Open
josh-hogle opened this issue Sep 20, 2023 · 1 comment
Open

Version.LessThan() function not working properly #48

josh-hogle opened this issue Sep 20, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@josh-hogle
Copy link

Description

When using v0.19.0 of the Go library with v0.19.0 of the C library, I get the following warning message:

Note: the loaded ObjectBox C library should be updated.
      Found ObjectBox version 0.19.0, but the minimum recommended version is 0.18.1.

Basic info

Please complete the following information:

  • ObjectBox version (are you using the latest version?): v0.19.0 (Go and C libraries)
  • Reproducibility: always
  • Device: desktop
  • OS: Debian

How to reproduce

Simply build a small demo program similar to the getting started example and compile it and you should get the warning.

Expected behavior

No warning(s) should be emitted as the "C" library is greater than/equal to the Go library version.

Code

Check the LessThan() function in version.go on line 35. It appears to me that this may be causing the issue. You may also want to just use the golang.org/x/mod/semver package to simplify your version comparison and management.

@josh-hogle josh-hogle added the bug Something isn't working label Sep 20, 2023
@levin-go
Copy link

I have also discovered the same issue. When I was running the latest version on armv7, I encountered a panic
image

the code in version.go

func (v Version) LessThan(other Version) bool {
  return v.Major < other.Major || v.Minor < other.Minor || v.Patch < other.Patch
}

should be change to ?

func (v Version) LessThan(other Version) bool {
  if v.Major > other.Major {
    return false
  }
  if v.Minor > other.Minor {
    return false
  }
  if v.Patch > other.Patch {
    return false
  }
  if (v.Major == other.Major && v.Minor == other.Minor && v.Patch == other.Patch){
    return false
  }
  return true
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants