Skip to content

Commit

Permalink
Refactor inline unnecessary vars
Browse files Browse the repository at this point in the history
  • Loading branch information
jdsutherland committed Aug 30, 2018
1 parent 5faa585 commit 305edf2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions cmd/submit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ func TestLegacySolutionMetadataMigration(t *testing.T) {
dir := filepath.Join(tmpDir, "bogus-track", "bogus-exercise")
os.MkdirAll(dir, os.FileMode(0755))

// Write fake legacy solution
solution := &workspace.Solution{
ID: "bogus-solution-uuid",
Track: "bogus-track",
Expand All @@ -233,15 +232,14 @@ func TestLegacySolutionMetadataMigration(t *testing.T) {
Dir: tmpDir,
UserViperConfig: v,
}
expectedPathAfterMigration := exercise.MetadataFilepath()
_, err = os.Stat(expectedPathAfterMigration)
_, err = os.Stat(exercise.MetadataFilepath())
assert.Error(t, err)

err = runSubmit(cfg, pflag.NewFlagSet("fake", pflag.PanicOnError), []string{file})
assert.NoError(t, err)
assert.Equal(t, "This is a file.", submittedFiles["file.txt"])

_, err = os.Stat(expectedPathAfterMigration)
_, err = os.Stat(exercise.MetadataFilepath())
assert.NoError(t, err)
_, err = os.Stat(exercise.LegacyMetadataFilepath())
assert.Error(t, err)
Expand Down
4 changes: 2 additions & 2 deletions workspace/solution.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ func (s *Solution) Write(dir string) error {
if err = os.MkdirAll(filepath.Join(dir, ignoreSubdir), os.FileMode(0755)); err != nil {
return err
}
exercise := NewExerciseFromDir(dir)
if err = ioutil.WriteFile(exercise.MetadataFilepath(), b, os.FileMode(0600)); err != nil {
if err = ioutil.WriteFile(NewExerciseFromDir(dir).MetadataFilepath(), b,
os.FileMode(0600)); err != nil {
return err
}
s.Dir = dir
Expand Down

0 comments on commit 305edf2

Please sign in to comment.