Skip to content

Commit

Permalink
chg: Rename Consolidated Packages
Browse files Browse the repository at this point in the history
Consolidated the "path" and "io" packages into fsio. Short for File
System Input Ouput. Should prevent having to giving the package an
alternate name when importing with the Go path package.
  • Loading branch information
b01 committed Feb 2, 2024
1 parent d146d25 commit f1fe242
Show file tree
Hide file tree
Showing 26 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/.idea/
/git/testdata/repo-01/
/git/tmp/
/path/tmp/
/fsio/tmp/

# Files
# -----
Expand Down
2 changes: 1 addition & 1 deletion path/directory.go → fsio/directory.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package path
package fsio

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion path/directory_test.go → fsio/directory_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package path
package fsio

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion io/io.go → fsio/io.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io
package fsio

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion io/io_test.go → fsio/io_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io
package fsio

import (
"io"
Expand Down
2 changes: 1 addition & 1 deletion path/path.go → fsio/path.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package path
package fsio

import (
"os"
Expand Down
2 changes: 1 addition & 1 deletion path/path_test.go → fsio/path_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package path
package fsio

import (
"github.com/kohirens/stdlib"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions git/git_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package git

import (
"fmt"
"github.com/kohirens/stdlib/path"
"github.com/kohirens/stdlib/fsio"
"github.com/kohirens/stdlib/test"
"os"
"path/filepath"
Expand Down Expand Up @@ -43,7 +43,7 @@ func TestCloneFromBundle(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := CloneFromBundle(tt.args.bundleName, TmpDir, tt.args.bundleDir, tt.args.ps)
if path.Exist(got) != tt.want {
if fsio.Exist(got) != tt.want {
t.Errorf("CloneFromBundle() = %v, want %v", got, tt.want)
}
})
Expand Down
4 changes: 2 additions & 2 deletions web/form_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package web

import (
"github.com/kohirens/stdlib/path"
"github.com/kohirens/stdlib/fsio"
"net/url"
"testing"
)
Expand Down Expand Up @@ -61,7 +61,7 @@ func TestParseForm2(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
event := loadEvent("testdata/" + tt.form)
_, _ = path.CopyToDir(tt.upload, "./", "/")
_, _ = fsio.CopyToDir(tt.upload, "./", "/")

got, err := ParseFormWithFiles(event.Body, tt.contentType)
if (err != nil) != tt.wantErr {
Expand Down
4 changes: 2 additions & 2 deletions web/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package web

import (
"fmt"
"github.com/kohirens/stdlib/fsio"
"github.com/kohirens/stdlib/log"
"github.com/kohirens/stdlib/path"
"os"
)

Expand Down Expand Up @@ -35,7 +35,7 @@ func (ls *LocalStorage) Save(content []byte, filename string) (int, error) {
func (ls *LocalStorage) Load(pagePath string) ([]byte, error) {
Log.Infof(Stdout.LoadPage, pagePath)

if !path.Exist(pagePath) {
if !fsio.Exist(pagePath) {
return nil, fmt.Errorf("file %v not found", pagePath)
}

Expand Down
4 changes: 2 additions & 2 deletions web/web_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
"encoding/json"
"fmt"
"github.com/aws/aws-lambda-go/events"
"github.com/kohirens/stdlib/path"
"github.com/kohirens/stdlib/fsio"
"os"
)

func loadEvent(s string) events.LambdaFunctionURLRequest {
if !path.Exist(s) {
if !fsio.Exist(s) {
panic(fmt.Sprintf("file %s not found", s))
}

Expand Down

0 comments on commit f1fe242

Please sign in to comment.