github.com/GoogleContainerTools/skaffold@v1.39.18/pkg/skaffold/initializer/analyze/directory.go (about)

     1  /*
     2  Copyright 2020 The Skaffold Authors
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package analyze
    18  
    19  import "context"
    20  
    21  // directoryAnalyzer is a base analyzer that can be included in every analyzer as a convenience
    22  // it saves the current directory on enterDir events. Benefits to include this into other analyzers is that
    23  // they can rely on the current directory var, but also they don't have to implement enterDir and exitDir.
    24  type directoryAnalyzer struct {
    25  	currentDir string
    26  }
    27  
    28  func (a *directoryAnalyzer) analyzeFile(ctx context.Context, file string) error {
    29  	return nil
    30  }
    31  
    32  func (a *directoryAnalyzer) enterDir(dir string) {
    33  	a.currentDir = dir
    34  }
    35  
    36  func (a *directoryAnalyzer) exitDir(_ string) {
    37  	// pass
    38  }