summaryrefslogtreecommitdiff
tag namev0.23.0 (e2742eb6475f7fa963f7a99c2d7d7ecb2bebfb94)
tag date2021-02-05 19:46:14 +0700
tagged byShulhan <m.shulhan@gmail.com>
tagged objectcommit 20560fbf74...
downloadpakakeh.go-0.23.0.tar.xz
share v0.23.0 (2021-02-05)
This release bring major refactoring to package memfs to allow embedding two or more directories in single package. The minimum Go version is increased to 1.14. === Breaking changes * memfs: refactoring, allow multiple instances of memfs in single package Previously, the generated Go code from memfs can be used only once on the package that use it. For example, if we have two instances of memfs.MemFS and both of them call GoGenerate(), when we load them back again only the last one will be active and set the global variable memfs.GeneratedPathNode. This changes refactoring on how we use memfs by storing the generated path node into variable that is defined by user and pass them to New Options. * memfs: remove field WithContent The field WithContent is not necessary if we set MaxFileSize to negative value. * http: embed the memfs.Options into ServerOptions This is to minimize duplicate on fields names and give clear distinction between options for Server and options for serving files on memory using memfs. * io: embed the memfs.Options into DirWatcher This is to minimize duplicate configuration between DirWatcher and memfs, and to allow clear distinction between which options that affect the directory tree and options for DirWatcher. * memfs: allow AddFile to set internal path Previously, AddFile set the internal path equal to path of file to be included. This may cause conflict if the file is already included due to the same sys path but different internal path. This commit add parameter internalPath to set custom internal path in the memfs map. * memfs: refactoring Go generate code to use memfs.MemFS instance Instead of using memfs.PathNode, which is confusing for new user (what is PathNode?), we actually can use memfs.MemFS instance. This effect on how we use memfs in http package. * dns: change the SOA field in ZoneFile to non-pointer The reason we use pointer for SOA record is so we can save them only if its not nil. A nil SOA record cause the generated JSON become "null" and this is make the consumer of ZoneFile do more work, checking for the null and initialize it when required. This changes, make the SOA record to non-nil and we save the record only if the MName field is not empty. * dns: replace master word with zone This is for consistency for type and variable names. * sql: sort returned names on ExtractSQLFields sorted in ascending This is to make sure that any test that use the package always predictable. While at it, add paramter to change placeholder on ExtractSQLFields. === New features * http: add method Post on client The Post method send the POST request to path without setting "Content-Type". * lib/clise: new package that implement circular slice A circular slice is a slice that have fixed size. An append to slice that has reached its length will overwrite and start again from index 0. For example, a clise with size 5, c := clise.New(5) c.Push(1, 2, 3, 4, 5) fmt.Printf("%v\n", c.Slice()) // [1 2 3 4 5] If we push another item, it will overwrite the first index, c.Push(6) fmt.Printf("%v\n", c.Slice()) // [6 2 3 4 5] See the examples for usage of the package. * time: add function UnixMicro that return UNIX time in micro seconds * api/slack: simple API for sending message to Slack using only standard packages. * runes: add function to inverse the slice of rune The Inverse function reverse the order of slice of rune without allocating another slice. * big: add method Humanize The Humanize method return the r as string with custom thousand and decimal separator. * big: add method to round fraction to nearest non-zero value The RoundNearestFraction does not require precision parameter, like in other rounds function, but it figure it out based on the last non-zero value from fraction. === Enhancements * dns: change the error messages on ResourceRecord initAndInitialize This change make the error message more readable and understandable by consumer * dns: add method to get list of non-local caches in the Server The CachesLRU method return the list of non-local caches ordered by the least recently used. This changes affect the answer type which must be exported, including most of its fields, so consumer can access it. === Bug fixes * sql: check nil on Migrate parameter "fs" using reflect.IsNil If we pass nil pointer of type to fs, the if condition will not true and this cause panic because fs is not nil. * http: fix the package documentation The RegisterXxx methods on Server has been replaced with single method, RegisterEndpoint. * dns: fix saving the TXT record file on zone file The TXT record value must be wrapped with quote when stored on zone file.