n10v / id3v2

🎵 ID3 decoding and encoding library for Go
https://pkg.go.dev/github.com/bogem/id3v2/v2
MIT License
339 stars 52 forks source link

interface downwards compatibility / versioning #5

Closed mro closed 8 years ago

mro commented 8 years ago

this is a general go issue.

e.g. commit bf5a8edb790005 removed AddCommentFrame from the public API. This breaks the API.

How do you intend to handle such cases in the future?

P.S.: The solution proposed in http://stackoverflow.com/questions/24855081/how-do-i-import-a-specific-version-of-a-package-using-go-get#comment51770955_26546559 does not work if there are subpackages, because they contain the repository name of the 'parent' package.

n10v commented 8 years ago

ID3v2 is in beta version. Until version 1.0 the API will change. After this version the existing API won't change. But there will be adding new features. Instead of tag.AddPictureFrame(frame), you should use tag.AddFrame(tag.ID("Attached picture"), frame).

n10v commented 8 years ago

I will necessarily add it to README

mro commented 8 years ago

tag.AddFrame(tag.ID("Attached picture"), frame)

grrr, are you serious? This makes field name typos runtime errors instead of compiletime errors.

What's the roadmap to 1.0?

n10v commented 8 years ago

Yes, you are right. In 0.8 I will return Add(Picture/Comment/UnsynchronisedLyricsText)Frame functions. The main properties of 1.0 should be stability and convenient API.

n10v commented 8 years ago

I retuned these functions in https://github.com/bogem/id3v2/commit/7b84e16ca945c04c749c0bfa9bd6765b160fc7b9. If you'll have more offers to improve id3v2 library, I will glad to hear them :)

mro commented 8 years ago

Tag.Flush was replaced by Save, right? IMO Flush was the more precise name, what made you change it to Save? See https://travis-ci.org/mro/internet-radio-recorder/jobs/155643729#L342

n10v commented 8 years ago

I was inspired by taglib, when I did this change. I like Save more, because It's simplier, friendlier and more precise than Flush. And if you noticed, I split Flush function to two functions: Save snd Close. So you should manually close tag after all operations with it. You could also defer closing.

mro commented 8 years ago

ic, I wasn't aware Flush closes. I know flush from C where it operates on a stream. Save really may be more appropriate for a data-structure.

n10v commented 8 years ago

And as tag is a data structure, I chose Save as a name for this function