Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Kadai2 edm20627 #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
keethii27 wants to merge 24 commits into gopherdojo:master
base: master
Choose a base branch
Loading
from keethii27:kadai2-edm20627
Open
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
7dc7e7a
ひとまず動くものを作成
keethii27 Feb 25, 2021
5aed38c
ユーザ定義型を作成
keethii27 Feb 25, 2021
9dc9755
自作パッケージを作成
keethii27 Feb 25, 2021
7d5d81e
vlid関数をメソッドに変更
keethii27 Feb 25, 2021
7776099
微修正
keethii27 Feb 25, 2021
a504b57
画像変換処理のエラーハンドリング追加
keethii27 Feb 25, 2021
44bbfd1
削除フラグの追加
keethii27 Feb 25, 2021
87c6eb3
GoDocを生成する
keethii27 Feb 25, 2021
44e95d3
サンプル画像を追加
keethii27 Feb 25, 2021
f21ec02
README.md 追加
keethii27 Feb 26, 2021
49c5e89
.gitignore
keethii27 Feb 26, 2021
74fabfa
go mod tidy 実行'
keethii27 Feb 26, 2021
f4be072
.gitignoreの配置変更
keethii27 Apr 7, 2021
183f52f
課題1をコピー
keethii27 Apr 7, 2021
5fefe04
go moduleパス変更
keethii27 Apr 8, 2021
e1ba6c2
リファクタリング
keethii27 Apr 8, 2021
7caa18b
テスト追加
keethii27 Apr 17, 2021
c75f90f
fix エラーハンドリング追加
keethii27 May 2, 2021
6d344e9
fix タイポ
keethii27 May 2, 2021
3f72fd8
fix ネストが深いためValidメソッドをリファクタリング
keethii27 May 2, 2021
38cf933
fix TestValidに正 to 否、否 to 正ケースを追加
keethii27 May 2, 2021
539b81a
fix テスト用画像を使用しテストできるようにtastdataを作成
keethii27 May 2, 2021
1133222
fix DeleteOptionのテスト追加
keethii27 May 2, 2021
6d99bb2
fix 実際にテストでファイル削除しているか確認できるように修正
keethii27 May 6, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
リファクタリング
  • Loading branch information
keethii27 committed Apr 8, 2021
commit e1ba6c2c744c68bb6cb40b08e9a4cad5ca9cd19c
10 changes: 7 additions & 3 deletions kadai2/edm20627/imageconvert/imageconvert.go
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ import (
var SupportedFormat = []string{"png", "jpg", "jpeg", "gif"}

type ConvertImage struct {
filepaths []string
Filepaths []string
From, To string
DeleteOption bool
}

// Get the target files for image conversion.
func (ci *ConvertImage) Get(dirs []string) error {
if len(dirs) == 0 {
return errors.New("Need to specify directory or file")
}

for _, dir := range dirs {
err := filepath.Walk(dir,
func(path string, info os.FileInfo, err error) error {
Expand All @@ -30,7 +34,7 @@ func (ci *ConvertImage) Get(dirs []string) error {
if info.IsDir() || filepath.Ext(path)[1:] != ci.From {
return nil
}
ci.filepaths = append(ci.filepaths, path)
ci.Filepaths = append(ci.Filepaths, path)
return nil
})
if err != nil {
Expand All @@ -42,7 +46,7 @@ func (ci *ConvertImage) Get(dirs []string) error {

// Perform image conversion.
func (ci *ConvertImage) Convert() error {
for _, path := range ci.filepaths {
for _, path := range ci.Filepaths {
err := convert(path, ci.To, ci.DeleteOption)
if err != nil {
return err
Expand Down

AltStyle によって変換されたページ (->オリジナル) /