• Agniva De Sarker's avatar
    go/ast: fix SortImports to handle block comments (take 2) · bf670bd8
    Agniva De Sarker authored
    This is a 2nd attempt at fixing CL 162337 which had an off-by-one error.
    We were unconditionally getting the position of the start of the next line
    from the last import without checking whether it is the end of the file or not.
    
    Fix the code to check for that and move the testcase added in CL 190523
    to the end of the file for it to trigger the issue properly.
    
    Fixes #18929
    
    Change-Id: I59e77256e256570b160fea6a17bce9ef49e810df
    Reviewed-on: https://go-review.googlesource.com/c/go/+/190480
    Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
    bf670bd8
import.input 2.1 KB