m-lab / go

General purpose libraries / APIs for use in mlab code.
Apache License 2.0
5 stars 6 forks source link

Add flagx.File type #124

Closed stephen-soltesz closed 4 years ago

stephen-soltesz commented 4 years ago

This change introduces a new flag type flagx.File that preserves the file name during flag handling and should eventually replace flagx.FileBytes.

In my own experience and two recent PRs (https://github.com/m-lab/measure-saver/pull/7 & https://github.com/m-lab/alertmanager-github-receiver/pull/44 ) it would be more helpful for the file name to be displayed by the flag processing logic, rather than the file contents. The flagx.FileBytesArray introduced this idea. This change adds a new flag type that exposes both the File.Bytes and the File.Name.

This change introduces a new type rather than modifying FileBytes because the shorter name better represents the flag purpose, and prevents the naming stutter of FileBytes.Bytes, as well, this preserves compatibility with existing users of the flagx.FileBytes type until they can be migrated to this replacement.


This change is Reviewable

coveralls commented 4 years ago

Pull Request Test Coverage Report for Build 897


Totals Coverage Status
Change from base Build 890: 0.2%
Covered Lines: 1313
Relevant Lines: 1538

💛 - Coveralls