patch a bug in Taxid parsing

This commit is contained in:
Eric Coissac
2024-12-19 13:54:23 +01:00
parent 795df34d1a
commit abfa8f357a
2 changed files with 3 additions and 2 deletions

View File

@ -7,7 +7,7 @@ import (
// TODO: The version number is extracted from git. This induces that the version // TODO: The version number is extracted from git. This induces that the version
// corresponds to the last commit, and not the one when the file will be // corresponds to the last commit, and not the one when the file will be
// commited // commited
var _Commit = "f41a6fb" var _Commit = "795df34"
var _Version = "Release 4.2.0" var _Version = "Release 4.2.0"
// Version returns the version of the obitools package. // Version returns the version of the obitools package.

View File

@ -21,7 +21,7 @@ type TaxidFactory struct {
func NewTaxidFactory(code string, alphabet obiutils.AsciiSet) *TaxidFactory { func NewTaxidFactory(code string, alphabet obiutils.AsciiSet) *TaxidFactory {
return &TaxidFactory{ return &TaxidFactory{
inner: NewInnerString(), inner: NewInnerString(),
code: code + ":", code: code,
alphabet: alphabet, alphabet: alphabet,
} }
// Initialize and return a new TaxidFactory. // Initialize and return a new TaxidFactory.
@ -35,6 +35,7 @@ func (f *TaxidFactory) FromString(taxid string) (Taxid, error) {
if len(part2) == 0 { if len(part2) == 0 {
taxid = part1 taxid = part1
} else { } else {
//log.Warnf("TaxidFactory.FromString: taxid %s -> -%s- -%s- ", taxid, part1, part2)
if part1 != f.code { if part1 != f.code {
return nil, fmt.Errorf("taxid %s string does not start with taxonomy code %s", taxid, f.code) return nil, fmt.Errorf("taxid %s string does not start with taxonomy code %s", taxid, f.code)
} }